• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Roldan Baldo
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roldan Baldo
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic