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.实心圆

posted @ 2021-08-11 22:22  Eleanor123  阅读(166)  评论(0编辑  收藏  举报