I have a program that detects when certain machines are online and creates a button with a green \"online\" icon to show this. I want to add the functionality to check perio
I know how to set the icon, however I can't figure out a way to do it once the button has already been displayed
probably you have issues with Concurency in Swing, that means that all Swing code must be done on EDT
then you have to wrap myButton.setIcon(myIcon)
to the invokeLater()
, for example
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
myButton.setIcon(myIcon);
}
});