aspose file tools*
The moose likes Threads and Synchronization and the fly likes simultaneosly running server class and JFrame, the JFrame wont show the components. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "simultaneosly running server class and JFrame, the JFrame wont show the components." Watch "simultaneosly running server class and JFrame, the JFrame wont show the components." New topic
Author

simultaneosly running server class and JFrame, the JFrame wont show the components.

Roldan Baldo
Ranch Hand

Joined: Aug 11, 2009
Posts: 99
SERVER


CONNECTIONHANDLER


and a Simple JFrame


my main class here



why is it that the JFrame will not show its components properly,? the server is running. but i have no components seen in JFrame
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Your GUI code is not being executed in the Event Dispatcher Thread. Sure, you enter the EDT. But then you launch another thread that does the GUI work.

Scratch that. You are creating the GUI in the EDT - the "new ui()" does that. The thread that will be "running" it will not do anything, since ui's run() method does absolutely nothing.
But this isn't your real code; for one, Server doesn't implement Runnable so line 6 of your Main class will not compile. PostRealCode.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Roldan Baldo
Ranch Hand

Joined: Aug 11, 2009
Posts: 99
sorry i forgot the extends thread in the server, now its ok. my real code is complicated though. how will the GUI work as i wanted to?
thanks.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

You will have to post real code which shows the problem. I copy the code you put up here and the frame and button get displayed correctly.

Steve
 
wood burning stoves
 
subject: simultaneosly running server class and JFrame, the JFrame wont show the components.