📄 jm2dlabel.java.svn-base
字号:
package jm.framework.gui.module;
import java.awt.*;
import javax.swing.*;
public class JM2DLabel extends JLabel {
private static final long serialVersionUID = 3627475937887661444L;
// private final String CLASS_NAME = "RELCOLORLABEL";
protected Color poBklra = Color.white; // 忋怓
protected Color poBklrb = Color.white; // 壓怓
protected String psText = ""; // 暥帤
protected boolean gb = false; // 暥帤
// private final String BEGIN = "Begin ...";
// private final String END = "End ...";
public JM2DLabel() {
super();
gb = true;
}
public JM2DLabel(Icon aoImage) {
super(aoImage);
}
public JM2DLabel(String text) {
super(text);
}
/**
* 弶婜婲摦愝掕
*
* @param aoUpColora
* 忋怓愝掕
*/
public JM2DLabel(Color aoUpColora) {
this(aoUpColora, Color.white, "");
}
/**
* 弶婜婲摦愝掕
*
* @param aoUpColora
* 忋怓愝掕
* @param aoEndColorb
* 壓怓愝掕
*/
public JM2DLabel(Color aoUpColora, Color aoEndColorb) {
this(aoUpColora, aoEndColorb, "");
}
/**
* 弶婜婲摦愝掕
*
* @param aoEndColorb
* 壓怓愝掕
* @param asText
* 暥帤愝掕
*/
public JM2DLabel(Color aoEndColorb, String asText) {
this(Color.white, aoEndColorb, asText);
}
/**
* 弶婜婲摦愝掕
*
* @param aoUpColora
* 忋怓愝掕
* @param aoEndColorb
* 壓怓愝掕
* @param asText
* 暥帤愝掕
*/
public JM2DLabel(Color aoUpColora, Color aoEndColorb, String asText) {
poBklra = aoUpColora; // 忋怓愝掕
poBklrb = aoEndColorb; // 壓怓愝掕
psText = asText; // 暥帤愝掕
setDefault();
super.setText(psText);
}
private void setDefault() {
this.setFont(JMItemCode.FT_LABEL);
}
/**
* 擇怓愝掕張棟
*
* @param g
* Graphics丂僆僽僕僃僋僩
*/
public void paint(Graphics g) {
super.paint(g);
this.setFont(JMItemCode.FT_LABEL);
if (gb) {
return;
}
int iHeigh = this.getHeight();
int iWith = this.getWidth();
// 忋怓愝掕
g.setColor(poBklra);
g.fillRect(0, 0, iWith, iHeigh / 2);
// 壓怓愝掕
g.setColor(poBklrb);
g.fillRect(0, iHeigh / 2, iWith, iHeigh);
// 暥帤愝掕
g.setColor(Color.black);
g.drawString(psText, 0, this.getFont().getSize());
super.setText(psText);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -