?? filledrectangle.java
字號(hào):
import java.awt.*;
import java.io.Serializable;
public class FilledRectangle extends DrawnShape implements Serializable{
static final long serialVersionUID = -1673164085474047543L;
public FilledRectangle(Color color, int x, int y) {
super(color, x, y, "draw filled rectangle");
}
public void draw(Graphics g) {
int width = x2 > x1 ? x2 - x1 : x1 - x2;
int height = y2 > y1 ? y2 - y1 : y1 - y2;
g.setColor(color);
if (perm) {
g.fillRect(Math.min(x1, x2), Math.min(y1, y2), width, height);
} else {
g.drawRect(Math.min(x1, x2), Math.min(y1, y2), width, height);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -