AWT-画笔(AWT brush)

AWT-画笔

package com.deng.lesson03;

import java.awt.*;

public class TestPaint {
    public static void main(String[] args) {
     new MyPaint().loadFrame();
    }
}
class MyPaint extends Frame{
     public void loadFrame(){
    setBounds(400,400,600,600);
    setVisible(true);
}
   //画笔
    @Override
    public void paint(Graphics g) {
         //画笔,需要有颜色,可以画画
          g.setColor(Color.BLUE);
        //g.drawOval(100,1001,100,100);
        g.fillOval(200,200,400,400);//实心的圆
        //g.setColor(Color.RED);
        g.fillRect(150,200,200,200);
       //画笔用完还原到最初的颜色
    }
}
————————

AWT brush

package com.deng.lesson03;

import java.awt.*;

public class TestPaint {
    public static void main(String[] args) {
     new MyPaint().loadFrame();
    }
}
class MyPaint extends Frame{
     public void loadFrame(){
    setBounds(400,400,600,600);
    setVisible(true);
}
   //画笔
    @Override
    public void paint(Graphics g) {
         //画笔,需要有颜色,可以画画
          g.setColor(Color.BLUE);
        //g.drawOval(100,1001,100,100);
        g.fillOval(200,200,400,400);//实心的圆
        //g.setColor(Color.RED);
        g.fillRect(150,200,200,200);
       //画笔用完还原到最初的颜色
    }
}