In my method doWork() I call
SwingUtilities.invokeLater(new Runnable(){
public void run() {
button.setBackgroundColor(Color.red);
}
});
then I call
SwingUtilities.invokeLater(new Runnable(){
public void run() {
button.setBackgroundColor(Color.blue);
}
});
Question whether will be button is red then blue, or blue then red?
invokeLater()
adds its parameter to the Swing event queue. so they will be executed in the order they were added, i.e. first red then blue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With