How to reload a JPanel?

筅森魡賤 提交于 2019-12-13 12:06:45

问题


I'm a java newbie... I need to know how to reload a JPanel? I extended the JPanel class and created a panel that will run in a cardlayout in an Applet. I want this panel to reload/refresh after the user clicks a button in this panel. I tried including the revalidate() and repaint() methods (methods I don't understand well) in the ActionListener for the button but nothing happened. Can anyone throw some light on how to correctly refresh the whole panel?


回答1:


This works fine for me. But after an other

_panel.revalidate();
_panel.repaint();


来源:https://stackoverflow.com/questions/17608421/how-to-reload-a-jpanel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!