美文网首页
绘图五环

绘图五环

作者: 哈迪斯Java | 来源:发表于2021-11-23 07:57 被阅读0次

    import javax.swing.;
    import java.awt.
    ;

    public class FiveCircle extends JFrame{
    private final int OvalWidth=80;
    private final int OvalHeight=80;
    public FiveCircle(){
    initialize();
    }
    private void initialize(){
    setSize(300,200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setContentPane(new DrawPane());
    setTitle("奥运五环");
    setVisible(true);
    }
    class DrawPane extends JPanel{
    @Override
    public void paint(Graphics g) {
    super.paint(g);
    g.drawOval(10,10,OvalWidth,OvalHeight);
    g.drawOval(80,10,OvalWidth,OvalHeight);
    g.drawOval(150,10,OvalWidth,OvalHeight);
    g.drawOval(50,70,OvalWidth,OvalHeight);
    g.drawOval(120,70,OvalWidth,OvalHeight);
    }
    }

    public static void main(String[] args) {
        FiveCircle fiveCircle = new FiveCircle();
    }
    

    }

    相关文章

      网友评论

          本文标题:绘图五环

          本文链接:https://www.haomeiwen.com/subject/bkoitrtx.html