Java socket prevents panel?

I am trying to create a panel while I am already connected to a server with a socket, but in java it shows a frame, but not inside the frame. The panel is displayed only after the outlet is closed, but I need it while it is open. How can i solve this? Is it because of a thread problem, or I just missed something ... Thanks ...

+4
source share
1 answer

Long-term tasks should never arise in an EDT . This includes blocking I / O operations. If such tasks do not change Swing components, just use a different thread. Otherwise, utilities are available (for example, SwingWorker and SwingUtilties ), which allows you to perform lengthy tasks in another thread and then publish the result as an action event in the EDT to modify any Swing components.

See also:

+5
source

All Articles