• Post Reply Bookmark Topic Watch Topic
  • New Topic

GUI won't appear

 
Donio Teixeira
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I start up my server and client applications, no errors occur and both operate as expected except my server GUI doesn't appear. It functions properly though. What could be causing the problem? I would appreciate any assistance!

Note: My server's gui was operating perfectly until I tried to implement threads

I added various System.out.println(jtaResults.getText()); throughout the constructor and the text area had the correct data although the GUI not appearing.
in public void run the program executes the line ServerApp gui = new ServerApp(); but never executes gui.setVisible(true); How do i force it to set the gui to visible?

ServerApp class - constructor




init components in the serverApp class:

 
Darryl Burke
Bartender
Posts: 5152
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a while(true) loop in the constructor, so your code never hits the setVisible(true) in main(...).

However, the real issue here is that a server application is not a JFrame, so shouldn't extend it. You should create a server application that runs independent of any GUI; then link a GUI and make sure that any long running tasks execute on a Thread other than the EDT, and that all Swing methods and constructors are called on the EDT. For more, see Concurrency in Swing.
 
Darryl Burke
Bartender
Posts: 5152
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Donio Teixeira
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where else would I create the while loop then? In some tutorials I was following they create the while loop in the same way i did. Or am i seriously confused?
 
Darryl Burke
Bartender
Posts: 5152
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you gone through the tutorial I linked to?
 
Donio Teixeira
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, i'm a lot more confused now
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!