GUI app freezing completely

Discussion in 'Java' started by Karsten Wutzke, Apr 29, 2008.

  1. 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...
     
    Karsten Wutzke, Apr 29, 2008
    #1
    1. Advertising

  2. 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?


    There are too many reasons for the application to hang to list them.

    You can try using debugger or SIGQUIT to get thread dumps to get some
    idea on what's hung and where it's spending time.

    You can try to isolate the problem by removing more and more code. It
    may make it simpler to find the cause of the problem.

    Best regards,
    Leonard Milcin

    --
    Simplicity is the ultimate sophistication.
    -- Leonardo da Vinci
     
    Leonard Milcin, Apr 29, 2008
    #2
    1. Advertising

  3. Well code that put for example in the actionPerformed method of
    ActionListener will not be executed in a separate thread from the GUI,
    so if you have a huge process going in that method it will
    block(disable) your GUI until that method returns. Try using a
    separate thread.
     
    Chase Preuninger, Apr 30, 2008
    #3
  4. Karsten Wutzke

    Philipp Guest

    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
     
    Philipp, Apr 30, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. fooooo
    Replies:
    5
    Views:
    901
    Paul Rubin
    May 3, 2005
  2. Jp Calderone
    Replies:
    1
    Views:
    1,347
    Paul Rubin
    May 24, 2005
  3. Mark rainess
    Replies:
    3
    Views:
    414
    Mark rainess
    Jul 23, 2006
  4. Replies:
    3
    Views:
    453
  5. webmaster

    application's GUI freezing

    webmaster, Jan 8, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    363
    webmaster
    Jan 8, 2009
Loading...

Share This Page