I am going through a legacy application which is using Swing and i am struggling to figure out how the screens are changing when a user clicks a button. One of the reasons i
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)
As per comments by ziggy (glad it helped)
Have a look at the PropertyChangeListener
s 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