repaint 没有调用 paintComponent 我很是纠结~~ 求高人指点啊
代码如下
public class GamePanel extends JPanel{ private Ground ground;
private Shape shape;
public void display(Ground ground,Shape shape) {
System.out.println("game panel's display");
this.ground = ground;
this.shape = shape;
this.repaint(); //@@@@@@@@@@@@@@@@@@@@@
}
public GamePanel(){
this.setSize(300,300);
}
public void paintComeponent(Graphics g){ //@@@@@@@
System.out.println("--------------------------------");
}
}
代码如下
public class GamePanel extends JPanel{ private Ground ground;
private Shape shape;
public void display(Ground ground,Shape shape) {
System.out.println("game panel's display");
this.ground = ground;
this.shape = shape;
this.repaint(); //@@@@@@@@@@@@@@@@@@@@@
}
public GamePanel(){
this.setSize(300,300);
}
public void paintComeponent(Graphics g){ //@@@@@@@
System.out.println("--------------------------------");
}
}
解决方案 »
- 哥哥们帮忙看下for循环语句方法
- Java记事本在打开文件后如何改变标签的名称
- Swing弹出窗口后如何使当前窗口(包括windows和java生成的)不丢失焦点
- 请问java内存布局如何查看?
- JTextArea的getText()方法为什么得不到,文本框中的内容?是不是必须用setText()才行?
- 如何动态创建所需要的类??和相应的属性?
- 菜鸟问 public void actionPerformed(ActionEvent e)中的e表示什么!?
- 求教一个复杂算法,高手请进
- Swing JTree登陆后动态加载
- 安装jbuilder7出现如下问题
- java操作sqlserver数据库问题
- JAVA要如何做基因演算法力继承的问题阿??
public void paintComeponent(Graphics g){paintComponent方法名都写错了