• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic