Swing - Changing the content of a panel using UpdateUI

心不动则不痛 提交于 2019-11-29 17:41:46

As per comments by ziggy (glad it helped)

Have a look at the PropertyChangeListeners that appear to be added in the code. In particular the propertyChange(PropertyChangeEvent e) method is where the code which changes the content will be present.

+1 to trashgod nice example/advice as always

trashgod

This is not an appropriate use of updateUI(), which "Resets the UI property to a value from the current look and feel." As the example itself may be unreliable, consider studying another. GoogleOlympiad, for example, sets a label's icon using a (cached) image.

ImageIcon image = getImage(index);
imageLabel.setIcon(image);


(source: drjohnbmatthews at sites.google.com)

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