Why Forge Swing GUI is currently hold with duct tape

Swing is single threaded, this means every creation / manipulation of Swing objects has to be done on the even dispatch thread.
This has a heavy implication that you dont bog down the even dispatch thread with heavy computation or the GUI wont update. The exact example of this done wrong is the progress bar which doesn't update if you move it around, but just smears.
Currently as a duct tape fix the whole Forge code runs on the even dispatch queue!
To disable the tape fix you have to comment the code in Gui_NewGame.java

The good course of action would be to fix this at some point. I'm just leaving it here for anyone wanting to do any GUI work on Forge.
You can read more here :
basically you need to use invokeLater or SwingWorker
http://www.javaworld.com/javaworld/jw-0 ... tml?page=1
This has a heavy implication that you dont bog down the even dispatch thread with heavy computation or the GUI wont update. The exact example of this done wrong is the progress bar which doesn't update if you move it around, but just smears.
Currently as a duct tape fix the whole Forge code runs on the even dispatch queue!
To disable the tape fix you have to comment the code in Gui_NewGame.java
- Code: Select all
SwingUtilities.invokeLater(new Runnable() {
public void run() {
AllZone.setComputer(new ComputerAI_Input(new ComputerAI_General()));
new Gui_NewGame();
}
});

The good course of action would be to fix this at some point. I'm just leaving it here for anyone wanting to do any GUI work on Forge.
You can read more here :
basically you need to use invokeLater or SwingWorker
http://www.javaworld.com/javaworld/jw-0 ... tml?page=1