java中Jpanel中的paint函数会自动被调用吗?
以下程序在jbuilder中运行paint函数没有被调用,为什么啊?packagegame_ball;importjava.awt.*;importjavax.swing...
以下程序在jbuilder中运行paint函数没有被调用,为什么啊?
package game_ball;
import java.awt.*;
import javax.swing.JPanel;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2007</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Panel_Game extends JPanel {
//Graphics g;
public void paint (Graphics g){System.out.println("hi");
Brick b=new Brick(g);
b.DrawBricks();
}
BorderLayout borderLayout1 = new BorderLayout();
public Panel_Game() {
super();
try {
jbInit();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
void jbInit() throws Exception {
this.setLayout(borderLayout1);
}
} 展开
package game_ball;
import java.awt.*;
import javax.swing.JPanel;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2007</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Panel_Game extends JPanel {
//Graphics g;
public void paint (Graphics g){System.out.println("hi");
Brick b=new Brick(g);
b.DrawBricks();
}
BorderLayout borderLayout1 = new BorderLayout();
public Panel_Game() {
super();
try {
jbInit();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
void jbInit() throws Exception {
this.setLayout(borderLayout1);
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询