JavaFX Utils

ChangeButtonOnPress

Component to change Button background on onMousePressed and onMouseReleased events.

ChangeButtonOnPress class is generic in T extends Button.

Constructors

	public ChangeButtonOnPress(T button, ImageView onPress, ImageView onRelease, boolean keepOldHandlers)
					

  • button : Button in which will be mounted animation.
  • onPress : ImageView to be set as background on onMousePressed event.
  • onRelease : ImageView to be set as background on onMouseReleased event.
  • keepOldHandlers : indicates if old EventHandlers are to keep or discard.

There are more constructors with different parameters, but all will internally call this first one.

Variations :

  • Constructors that don't receive keepOldHandlers this value is assumed as true.
  • Constructors that receive IComponent<T> component obtain Button from component.getNode() .
  • Constructors that receive Image onPress and Image onRelease will be used to instantiate ImageView.
  • Constructors that receive String onPressPath and String onReleasePath will be used to instantiate Image.
	public ChangeButtonOnPress(T button, ImageView onPress, ImageView onRelease)
					
	public ChangeButtonOnPress(T button, Image onPress, Image onRelease, boolean keepOldHandlers)
					
	public ChangeButtonOnPress(T button, Image onPress, Image onRelease)
					
	public ChangeButtonOnPress(T button, String onPressPath, String onReleasePath, boolean keepOldHandlers)
					
	public ChangeButtonOnPress(T button, String onPressPath, String onReleasePath)
					
	public ChangeButtonOnPress(IComponent<T> component, ImageView onPress, ImageView onRelease, boolean keepOldHandlers)
					
	public ChangeButtonOnPress(IComponent<T> component, ImageView onPress, ImageView onRelease)
					
	public ChangeButtonOnPress(IComponent<T> component, Image onPress, Image onRelease, boolean keepOldHandlers)
					
	public ChangeButtonOnPress(IComponent<T> component, Image onPress, Image onRelease)
					
	public ChangeButtonOnPress(IComponent<T> component, String onPressPath, String onReleasePath, boolean keepOldHandlers)
					
	public ChangeButtonOnPress(IComponent<T> component, String onPressPath, String onReleasePath)
					

Usage

	Button button;

	new ChangeButtonOnPress<>(button, IN_IMAGE, OUT_IMAGE).mount();
					

Links