Hello everybody!
I've run into a bit of a problem. I've made a ProgressGUI class (I'm aware that some already exist; I just wanted to make a more simple, custom version) that I'm using in collaboration with some save() and load() methods I'm using with Roster objects (that I've created to hold information for players, teams, etc.).
So, to test this I made a ProgressGUI to be used with my loadRoster() method, which is implemented roughly in a test class I've made.
Here's the load method's call in the test class:
//If I put a println here, the program prints it just fine Roster load = FileUtility.loadRoster("Test Roster"); //println's put here are not displayed
Here's what the part of the loadRoster() method with the ProgressGUI looks like:
And here's the ProgressGUI constructor:
public ProgressGUI(String title, String message, double progress) { super(new JFrame(), title, JDialog.ModalityType.APPLICATION_MODAL); setSize(400, 100); setResizable(false); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); build(); setMessage(message); javax.swing.JOptionPane.showMessageDialog(null, "Now setting location!"); //This message works setLocationRelativeTo(null); //println's put here are displayed setVisible(true); //println's put here are not displayed }
So, since all println's are displayed until after the ProgressGUI is displayed, I think the problem has something to do with the ProgressGUI wanting some sort of input, or needing to be disposed of before the program can continue...
Does anyone know how to allow this dialog to exist and update its display while other methods are executing (preferably avoiding adding a Thread, if possible)?