shiftyayef 0 Share Posted January 6, 2021 Hi, When trying to create a GUI for my script and initialise it in the "onStart" method, I am getting a persistent error: The first one it throws is: [ERROR] Swing threading error:: java.lang.Exception: State tracking must be done on Event Dispatch Thread. Try wrapping your method in SwingUtilities#invokeLater Followed by: 13:35:03: [ERROR] java.awt.IllegalComponentStateException: contentPane cannot be set to null. This is what I have wrapped in invokeLater, but it still throws the exception (GUI extends JFrame). SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GUI gui = new GUI("Shifty NMZ"); } }); My GUI is built using intellij's GUI designer forms - if I try and make a basic JFrame with only Swing, it doesn't throw an exception, so I'm a bit lost. Does anyone know what the cause/solution could be? Thank you UPDATE: My problem turned out to be related to the gradle configuration I was using to build my scripts. After creating a new project using Maven, creating an instance of the GUI inside SwingUtilities.invokeLater() worked fine. Leaving the rest of the post up in case anyone has similar issues in future. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.