Forum Stats

  • 3,815,603 Users
  • 2,259,058 Discussions


The JDialog got drawing issue when open and can't close with [x] button

user4044661 Member Posts: 1
edited Jun 23, 2017 4:41PM in Swing

I've got weird, random and strange issue with JDialog with JDK1.6.43.

The JDialog just a normal java swing dialog that contains JTextField, JTextArea, JButton...

The JDialog instance is newly created when is open.

Out of 200 - 300 times of opening the JDialog, the JDialog is shown with partially painted. I've tried to closed the JDialog by mouse click on [x], the JDialog is not closed.

Sometimes JDialog gets partially repainted when moving the mouse within the JDialog.


What I suspect with JDialog issue is

  • The JDialog is not fully repainted
    • I've looked at the RepaintManager to find why the JDialog is not fully paitnted, I don't find any issue with it.
  • The mouse event (left click) is not processed by the JDialog
    • I've looked at how JComponent mouse event, it loops through all its sub component to find out the sub component that contains mouse click location and delegate the mouse event to that sub component.

Has anyone experienced or encountered the similar issue?

Thanks & regards,



  • morgalr
    morgalr Member Posts: 457
    edited Jun 23, 2017 4:41PM

    In virtually every situation where I have seen this happened 2 things have controlled the outcome:

    1 -- event dispatch thread is busy. You have work being done on the EDT instead of just GUI processing.

    2 -- you are trying to control your app with looping instead of an event driven timer scenario.  You have someplace where you have a while(true) loop keeping your processing going--stop it! stop it right now and don't ever do that again!

    So without seeing your code, there is really no way to say, but my bet is that you have one of these 2 problems and it is effecting your EDT performance.

    BTW: I've been doing Java sine 1999.

This discussion has been closed.