GUI之画笔Paint绘制圆
package day16; import java.awt.*; public class PaintTest { public static void main(String[] args) { new Mypaint().loadFrame(); } } class Mypaint extends Frame { public void loadFrame() { setBounds(200, 300, 300, 300); setVisible(true); } //画笔 @Override public void paint(Graphics g) { //画笔的颜色设置 g.setColor(Color.BLUE); g.drawOval(100, 100, 100, 100);//绘制空心圆 // g.fillOval(100, 100, 100, 100);//实心圆 } }
执行结果:
1.空心圆
2.实心圆
欢迎批评指正,提出问题,谢谢!