?? separatorcomp.java
字號:
package jp.co.ntl.awt;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
public class SeparatorComp extends Component {
/**
*
*/
private static final long serialVersionUID = -3965013226747100256L;
public final static int VERTICAL = Separator.VERTICAL;
public final static int HORIZONTAL = Separator.HORIZONTAL;
private Separator sep;
private int direction;
public SeparatorComp() {
sep = new Separator(0, 0, 0);
this.direction = Separator.HORIZONTAL;
sep.setDirection(direction);
}
public SeparatorComp(int direction) {
sep = new Separator(0, 0, 0);
this.direction = direction;
sep.setDirection(direction);
}
public void setBounds(int x, int y, int width, int height) {
super.setBounds(x, y, width, height);
setSeparatorSize(width, height);
}
public void setSize(int x, int y) {
super.setSize(x, y);
setSeparatorSize(x, y);
}
public void setSize(Dimension d) {
super.setSize(d);
setSeparatorSize(d.getSize().width, d.getSize().height);
}
public void paint(Graphics g) {
if (sep == null) {
return;
}
sep.draw(g, getBackground().darker());
}
private void setSeparatorSize(int width, int height) {
if (direction == HORIZONTAL) {
sep.setSize(0, height / 2, width);
} else {
sep.setSize(width / 2, 0, height);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -