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

Emilian Bold <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAL6R17DdAwN2kS1SnqEXe9Ey9bT0y=Aj_+2pi8UHLxMxaVbEdg@mail.gmail.com>
Depends on your app, but perhaps a context aware action is a better fit.
Then the enabling/disabling is automatic.
http://wiki.netbeans.org/DevFaqActionContextSensitive




--emi

On Fri, Oct 28, 2016 at 8:23 PM, kmilito <[email protected]> wrote:

> 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.