Simple boolean AnAction

Hello,

I'm looking for a way to implement a button that change a boolean value. When The user clicks on the button, the button's color changes. The best for me is that the pressed button's color will be the same as the hovering color.

What is the best way to implement an AnAction with a button that changes its color after clicking on it?

Thanks!

0
2 comments
Avatar
Permanently deleted user

Please implement ToggleAction like this:

public class MyAction extends ToggleAction {
  private boolean myValue;

  public MyAction() {
  }

  @Override
  public boolean isSelected(AnActionEvent anActionEvent) {
    return myValue;
  }

  @Override
  public void setSelected(AnActionEvent anActionEvent, boolean b) {
    myValue = b;
  }

}

1
Avatar
Permanently deleted user

Thank you!

0

Please sign in to leave a comment.