import java.awt.*;
import java.awt.event.*;
public class TankClient extends Frame
{
public void print(Graphics g) {
Color c = g.getColor();
g.setColor(Color.red);
g.fillOval(50, 50, 30, 30); //使用当前颜色填充外接指定矩形框的椭圆。
g.setColor(c);
}
public void lauchFrame()
{
this.setLocation(80, 60);
this.setSize(800, 500);
this.setTitle("画圆");
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
this.setResizable(false);
this.setBackground(Color.GREEN);
setVisible(true);
}
public static void main(String[] args)
{
TankClient tc = new TankClient();
tc.lauchFrame();
}
}
在生成窗口后print函数是否能自动调用?若能的话怎么生不成红色的圆呢
------解决方案--------------------
print???paint!!