- import java.awt.Canvas;
- import java.awt.Graphics;
- import javax.swing.ImageIcon;
- public class gameBack extends Canvas{
- public gameBack(){
- System.out.println("canvas construction");
- }
- public void paint(Graphics g){
- System.out.println("canvas paint");
- }
- public static void main(String[] args) {
- gameBack gb = new gameBack();
- gb.setVisible(true);
- }
- }
复制代码 运行程序..觉得应该打印什么?
实际上只打印了construction..没paint;
有人知道原因吗? |