Reputation: 158
I am designing a project for a class that opens a series of GUI's before reaching the GUI. each component functions independently but when we try and use a message returned from a server to create a new GUI, it makes the window, but with none of the components. any ideas?
for example.
we have a log in screen come up, which then sends the ID to the server, which returns a list of available whiteboards to the client, this works fine. then when we want the client to create a GUI after the message received it comes up with a box that is titled correctly but none of the components are there. i had this working earlier skipping the available boards and just opening a whiteboard, none of the components of the whiteboard were created although, the computer thought it had created a whiteboard successfully.
we tried something like this...
ChooseBoardGUI newChoose = new ChooseBoardGUI(out, availableBoards);
newChoose.setVisible(true);
newChoose.pack();
String numberOfBoard = in.readLine().substring(2);
WhiteboardGUI a = createWhiteboard(out, numberOfBoard);
any ideas on why the new GUI would come up blank?
thanks for any help
Upvotes: 0
Views: 58
Reputation: 285403
Possible problems:
The solution is:
As an aside: it sounds as if your GUI is structured to throw several JFrames at the user. If so, consider re-designing your code so that your separate GUI's are geared towards creating JPanels, and then have your program show one main stable JFrame but swaps "views", again usually JPanels, via a CardLayout.
A great tutorial on Swing Concurrency: Lesson: Concurrency in Swing
Upvotes: 2