?? separator.java
字號:
/*
$Author: $
$Date: $
$Revision: $
$NoKeywords: $
*/
package jp.co.ntl.awt;
import java.awt.Graphics;
import java.awt.Color;
public class Separator {
public static final int VERTICAL = 0;
public static final int HORIZONTAL = 1;
private int x;
private int y;
private int length;
private int direction;
public Separator(int x, int y, int length) {
this.x = x;
this.y = y;
this.length = length;
direction = HORIZONTAL;
}
public Separator(int x, int y) {
this(x, y, 100);
}
public void setSize(int x, int y, int length) {
this.x = x;
this.y = y;
this.length = length;
}
public void setLength(int length) {
this.length = length;
}
public void setDirection(int direction) {
this.direction = direction;
}
public void draw(Graphics g, Color color) {
if (direction == HORIZONTAL) {
g.setColor(Color.white);
g.drawLine(x + 1, y + 1, x + 1 + length, y + 1);
g.setColor(color);
g.drawLine(x, y, x + length, y);
} else if (direction == VERTICAL) {
g.setColor(Color.white);
g.drawLine(x + 1, y - 1, x + 1, y - 1 + length);
//g.setColor(color);
g.drawLine(x, y, x, y + length);
} else {
throw new IllegalArgumentException("wrong argument direction");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -