JPanel removeAll doesn't get rid of previous components

陌路散爱 提交于 2019-11-29 09:30:51

You can simply try calling :

cdPanel.revalidate();
cdPanel.repaint();   // This is required in some cases

instead of

cdPanel.validate();
trashgod

As you are dealing with unpredictable latency, use a SwingWorker to do the loading in the background, as shown here. The example uses pack() to resize the label to that of the image, but you may want to use a fixed-size grid and scale the images, as shown here.

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