user1707095
user1707095

Reputation: 27

Java swing components are got frozen

I'm making a server-client application project in netbeans. I made some Jpanel, and some other stuff (buttons, textfield, textarea, menu) on my JFrame with the netbeans gui builder. When I push the new server button the whole JFrame and the all of its components are got frozen, but the server-client part is working on the background. I think there is a problem about the threads or something, but I've not really understood what i'm supposed to do.

Upvotes: 0

Views: 197

Answers (1)

Hovercraft Full Of Eels
Hovercraft Full Of Eels

Reputation: 285403

The problem is likely that your server-client code is in fact not working in the background but instead working on the Swing event thread. You can test this you know with a SwingUtilities method: SwingUtilities.isEventDispatchThread()

Also:

  • Are you using a SwingWorker to do the background work?
  • Are you doing any join() calls with a background thread?
  • Are you waiting on a SwingWorkers get() method?

The details of your code will likely help us give you more specific advice. To learn what you're supposed to do, please read, Lesson: Concurrency in Swing

Upvotes: 6

Related Questions