Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

About SwingUtilities.invokeLater()

843805Sep 25 2005 — edited Dec 19 2007
Hi,

I'm trying to figure SwingUtilities.invokeLater() out. I've been reading around here at sun, but I'm still a little confused. First of all WHEN should I use the SwingUtilities.invokeLater()? Is it always when I change some components? What if I do it in an event?

Fx I have the following problem: I have some code that is called from another thread. The called method changes some components, should that be within the SwingUtilities.invokeLater()? If so, what do I do about the this.setEnable()?
  public void _enable() {
    this.setEnabled(true);
    jButton1.setEnabled(true);
    tArea1.setEnabled(true);
    tArea2.setEnabled(true);
    jLabel1.setEnabled(true);
    jLabel2.setEnabled(true);
    splitPane.setEnabled(true);
}
/lars
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 16 2008
Added on Sep 25 2005
12 comments
2,911 views