为什么画不出图?
import 。。。。……
public class Game extends Frame{
private final static int FW = 400, FH = 510;
private final static int HKW = 300, HKH = 480;
public static void main(String[] args) {
new Game().newFrame();
}
public void newFrame() {
Frame f = new Frame();
f.setBounds(500,100,FW,FH);
f.setVisible(true);
f.setResizable(false);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void paint(Graphics g) {
Color c = g.getColor();
g.setColor(Color.RED);
g.drawRect(3,24,HKW,HKH);
g.setColor(c);
}
}