Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • GUI Threading problems


    Recommended Posts


    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() {
        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



    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


    This topic is now archived and is closed to further replies.

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.