Skip to content

Instantly share code, notes, and snippets.

@hendrikebbers
Created November 19, 2016 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendrikebbers/10639a551436a18872101a0df77f1a92 to your computer and use it in GitHub Desktop.
Save hendrikebbers/10639a551436a18872101a0df77f1a92 to your computer and use it in GitHub Desktop.
public class MyCustomButton extends Button {
private static PseudoClass EXPLODING_PSEUDO_CLASS = PseudoClass.getPseudoClass("exploding");
BooleanProperty exploding;
public MyCustomButton() {
exploding = new SimpleBooleanProperty(false);
exploding.addListener(e -> pseudoClassStateChanged(EXPLODING_PSEUDO_CLASS, exploding.get()));
getStyleClasses().add("exploding-button");
}
public void setExploding(boolean exploding) {
this.exploding.set(exploding);
}
public boolean isExploding() {
return this.exploding.get();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment