Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwingUtilities.invokeLater()

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?

like image 702
Tim Avatar asked Dec 22 '22 14:12

Tim


1 Answers

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.

like image 183
Michael Borgwardt Avatar answered Mar 03 '23 07:03

Michael Borgwardt