一.画笔
package lesson03;
import java.awt.*;
public class TextPaint {
public static void main(String[] args) {
new MyPaint().FrameLoad();
}
}
class MyPaint extends Frame {
public void FrameLoad() {
setVisible(true);
setBounds(200, 200, 600, 500);
}
@Override
public void paint(Graphics g) {
//super.print(g);
g.setColor(Color.green);
g.drawRect(150, 250, 300, 200);
g.setColor(Color.blue);
g.drawLine(300, 150, 125, 250);
g.drawLine(300, 150, 475, 250);
g.drawLine(125, 250, 475, 250);
g.setColor(Color.BLACK);
g.drawRect(175, 275, 75, 75);
g.drawRect(325, 325, 75, 125);
g.fillOval(375, 380, 20, 20);
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/d23377380ef75e363ca3aafe7ce3a44d.png)