Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it safe to construct Swing/AWT widgets NOT on the Event Dispatch Thread?
    text
    copied!<p>I've been integrating the <a href="https://substance.dev.java.net/" rel="noreferrer">Substance</a> look and feel into my application and ran into several problems regarding it's internal EDT (Event Dispatch Thread) checking routines. Substance absolutely refuses to construct UI classes outside of the EDT. I've done plenty of Swing/AWT and I know most of the rules regarding the EDT. I use SwingWorker, SwingUtilties.invokeLater to modify components. I always though that components could be <strong><em>CONSTRUCTED</em></strong> outside of the EDT, but must be <strong><em>realized</em></strong> and <strong><em>manipulated</em></strong> on the EDT. In other words, you can construct and setup defaults in the background but the call to pack/setVisible must be EDT as well as any subsequent calls to manipulate the component.</p> <p>The reason I ask is that I have a particularly "beefy" window to construct, involving many widgets, state, and resources (lots of icons). Previously, I constructed the window on the background method of a SwingWorker and made the window visible in the done method. Never had a single problem. Upon switching to Substance, the internal EDT checking bites me.</p> <p>I've been able to refactor code to get around this. I can construct on the EDT which isn't a good solution since the entire application will block. I can also refactor even more and try my best to load all of the extra resources outside of the EDT.</p> <p>Wrapping it up ... Is it safe to <strong><em>construct</em></strong> Swing/AWT widgets NOT on the Event Dispatch Thread?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload