troubleshooting Question

Refreshing DefaultListModel does not repaint

Avatar of boardtc
boardtcFlag for Ireland asked on
Java
42 Comments1 Solution501 ViewsLast Modified:
I have a popup JDialog descendant. I right click to open the popup and that displays fine. When the dialog is refreshed by clicking the option again is has the effect of clearing the list. I show the code outline below. If I debug through the code _or_ include a simple showMessageDialog within the loop the dialog repaints correctly.

Any ideas what's going on?

public class MyDialog extends JDialog {

    private MyList sampleModel;
   
    ...

    public void Show(String msg){
        MyList.clear();
        while(msg.length()>0){
          // populate list
          ...
          // refreshes correctly if include this message
          //JOptionPane.showMessageDialog(null,String.format("msg = %s",msg));
        }
        pack();
        setVisible(true);
    }
}

Thanks, Tom.
ASKER CERTIFIED SOLUTION
ForceRs

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 42 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 42 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros