Getting java.lang.IllegalStateException: This must happen in the event thread!, when disabling an action

"kmilito" <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
I got it to work by creating a new method like this


>     public void setActive(final boolean state){
>             SwingUtilities.invokeLater(new Runnable() {
>                 @Override
>                 public void run() {
>                     enabled = state;
>                     firePropertyChange("enabled", !enabled, enabled);
>                 }
>             });
>     }


Was there any better way to do it?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.