How to clear/ reset a JFrame

旧城冷巷雨未停 提交于 2019-12-06 05:26:50
mKorbel

if you remove any JComponent(s) from Container (only once on the end), is needed tell to Container for,

removeAll()//or remove(JComponent)
revalidate();
repaint();

Try to clear you Jpanel using:

paper.clearRect(0, 0, (int)panel.getSize().getWidth(), (int)panel.getSize().getHeight

where paper is something like: Graphics paper = panel.getGraphics();

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