Hello; hope this is the correct list to use, I've done plenty of Swing
programing before and not found a problem with it, so I feel like I'm okay
on the basics.  Can you keep the Cc: line intact when replying, as I'm not
a subscriber?  cheers...

Anyhow, it's an problem to do with changing window components, but windows
not updating.  I'm not sure why, since I've apparently done everything by
the book.  I've written a class which extends JFrame and changes one of
its panels in response to button clicks (an MS-style `Wizard').  In the
button click event handler, I fire off this function which updates the
window's state:

---------------------8<------------------------------------------
  private void updateState() {

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        if (current != null)
          topPanel.remove(current);

        current = (WizardQuestion) sequence.whichState();
        current.setPreferredSize(new Dimension(360, 384));
        current.preDisplay();
        topPanel.add(current, BorderLayout.CENTER);
        descText.setText(current.descriptive());
        descText.setEditable(false);
        descText.setBackground(Color.lightGray);
        setTitle(title+" : "+current.title());

        if (sequence.isLast())
          nextButton.setText("Finish");
        else
          nextButton.setText("Next >");

        if (sequence.isFirst())
          prevButton.hide();
        else
          prevButton.show();
        invalidate();
        repaint();
      }
    });
  }
---------------------8<------------------------------------------

and the window doesn't update immediately, usually taking 4-5 seconds.
I've tried various combinations of invalidate(), repaint() on both the
JFrame and its contentPane , but nothing makes it update My understanding
was that this code executes in a `safe' part of the Swing event loop where
these effects wouldn't be apparent.  I also notice there's a widely
documented revalidate() method for components which seems to be absent
since Swing 1.3.  Can anybody fill me in?

cheers,

-- 
Matthew       > http://www.soup-kitchen.net/
              > ICQ 19482073

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to