public class TextPaint {public static void main(String[] args) {Mypaint mypaint = new Mypaint();mypaint.loadFrame();}}class Mypaint extends Frame{public void loadFrame(){setBounds(200,200,600,500);setVisible(true);}//画笔@Overridepublic void paint(Graphics g) {//画笔要有颜色,画笔可以调色g.setColor(Color.red);// g.drawOval(100,100,100,100);g.fillOval(100,100,100,100);g.setColor(Color.GREEN);g.fillRect(200,200,200,200);repaint();//用完画笔记得还原为原来的颜色}}