问题:UserViewer 是一个JFrame public UserViewer(){
super("Mockup");
setSize( 800, 600 );
Container ContentPane = getContentPane();
toolBar = buildToolBar();
gc = new GraphController(curveType, bgType);
panel1=new JPanel();
panel1.add(gc, BorderLayout.CENTER);
mainPane = new JScrollPane(panel1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
ContentPane.add(toolBar,BorderLayout.NORTH);
ContentPane.add(mainPane, BorderLayout.CENTER);
g = ContentPane.getGraphics();
setVisible(true);
}
其中的gc是自己扩展的一个Jcomponment, 有自己的paint方法,当运行完程序以后,如果界面上出现了被别的东西遮挡的情况,那么
gc的被挡住的那个部分就不见了, 只有重新拉动一下整个窗口,才能够把图像完整的显示出来请问我的问题如何解决??谢谢!!
super("Mockup");
setSize( 800, 600 );
Container ContentPane = getContentPane();
toolBar = buildToolBar();
gc = new GraphController(curveType, bgType);
panel1=new JPanel();
panel1.add(gc, BorderLayout.CENTER);
mainPane = new JScrollPane(panel1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
ContentPane.add(toolBar,BorderLayout.NORTH);
ContentPane.add(mainPane, BorderLayout.CENTER);
g = ContentPane.getGraphics();
setVisible(true);
}
其中的gc是自己扩展的一个Jcomponment, 有自己的paint方法,当运行完程序以后,如果界面上出现了被别的东西遮挡的情况,那么
gc的被挡住的那个部分就不见了, 只有重新拉动一下整个窗口,才能够把图像完整的显示出来请问我的问题如何解决??谢谢!!
解决方案 »
- JPA(impl_hibernate4)_@Transactional问题
- GUI图形用户界面
- java怎样写导航面板
- Java 函数 返回多个数组以及数组的长度
- 关于 正则表达式 急 在线等
- 初学java,想问jdk安装哪个版本!?
- 如何删除一个JPanel对象啊
- 在线等,急!
- 请问 pathclass设置正确 语法正确 编译通过 但在执行时 显示"Exception in thread "main" java.lang.NoClassDefFoundError"…………不解
- 作业不知道哪不对,运行不出
- 关于double的精度和强转为整数的问题
- java的sdk有没有手动安装的办法?高手帮帮忙啊。
2、把这个frame进行show一次
即:
repaint();
this.show();
即可搞定
frame.invalidate();
frame.validate();