import java.awt.*;
public class TestPaint {
public static void main(String[] args) {
new MyPaint().loadFrame();
}
}
class MyPaint extends Frame{
public void loadFrame(){
setBounds(200,200,600,400);
setVisible(true);
}
@Override
public void paint(Graphics g) {
g.setColor(Color.red);
g.drawOval(100,100,100,100);
g.setColor(Color.GREEN);
g.fillRect(150,150,200,200);
//画笔用完,需要将其还原到最初的颜色
}
}