Re: GUI app freezing completely
- From: Philipp <sicsicsic@xxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 06:59:14 +0200
Karsten Wutzke wrote:
Hello all!
I have an application running where the user can set some look and
feels. On a few, when doing a click on a certain menu item the whole
app freezes completely.
The command behind that menu is executed fully (I debugged it), but
after it returns back into the calling code from the event dispatcher,
the window *freezes completely*. It must have something to do with the
look and feels, some simpler ones don't show the described behavior.
When issuing that command, I can only hear my hard disk doing
something shortly, then everything is frozen. I can't even close the
frame anymore. Repainting is gone.
Does anyone know how to debug something like that?
Karsten
PS: The action performed is simply sending a maybe 15 or 20 byte
string over a socket... there are no exceptions that occurr, no
unexecuted code...
You do know that all interactions with the GUI should be done in the Event Dispatching Thread?
In your case, it seems that this is guaranteed by the fact that the whole process is started by "doing a click on a certain menu item". So your socket code executes (unless specifically otherwise programmed by you) in this GUI painting thread. If this socket write hangs for any reason, the GUI will be frozen.
A possible alternative and maybe better design is to use a second thread to do the socket sending work. Use the javax.swing.SwingWorker<T,V> which makes this transition painless.
Phil
.
- References:
- GUI app freezing completely
- From: Karsten Wutzke
- GUI app freezing completely
- Prev by Date: Re: reflection: can I hack the class to make it public?
- Next by Date: What is Premature Optimization?
- Previous by thread: Re: GUI app freezing completely
- Next by thread: my sql connectivity
- Index(es):
Relevant Pages
|