📄 stopsign.java
字号:
import java.awt.*;
public class StopSign extends Canvas
{ private final static int[] X = {10,20,30,30,20,10, 0, 0};
private final static int[] Y = { 0, 0,10,20,30,30,20,10};
private final static Polygon P = new Polygon(X,Y,X.length);
private final static Color FILL_COLOR = new Color(200,0,0);
public StopSign ()
{ super();
setBackground(Color.lightGray);
}
public Dimension getPreferredSize()
{ return new Dimension(32,32); }
public void paint(Graphics g)
{ g.setColor(FILL_COLOR);
g.fillPolygon(P);
g.setColor(Color.black);
g.drawPolygon(P);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -