Skip to content
Bruno Dantas edited this page Jul 29, 2015 · 112 revisions

JavaFXUtils

The aim of JavaFXUtils Repository, is to create a Framework with some utilities for JavaFX Framework, creating some small components to help developers building their own applications.

Feel free to contribute by creating new components, finding or solving bugs, documenting and sharing this Repository! :)

Framework

Component is a class that implements IComponent which mounts some utilities on Node object, for example: Imagine that we want to trigger some code on double click of a Button.

With JavaFX you can do something like:

     Button button = new Button();

     button.setOnMouseClicked((event)->{
          if(event.getClickCount() == 2)
               this.onDoubleClick();
     });

On JavaFXUtils there is DoubleClickable which deal with click count for you, so you can write the equivalent to the above code like:

     Button button = new Button();

     new DoubleClickable<>(button, this::onDoubleClick).mount();

All components existent:

| Component | src | demoSrc | demoDownload | | ---------------------------- |:-------:| --------:| | Animation | src|demo Src | demo Download | | ButtonMagnifier | src| demo Src | demo Download | | ChangeButtonOnPass | src| demo Src | demo Download | | ChangeButtonOnPress | src| demo Src | demo Download | | ChangeMouseOnPass | src| demo Src | demo Download | | ChangeMouseOnPress | src| demo Src | demo Download | | DoubleClickable | src| demo Src | demo Download | | FXMLFile | src| demo Src | demo Download | | ImageMagnifier | src| demo Src | demo Download | | Movable | src| demo Src | demo Download | | MultiOption | src| demo Src | demo Download | | PassAnimation | src| demo Src | demo Download | | PressAnimation | src| demo Src | demo Download | | PressAndPassAnimation | src| demo Src | demo Download | | Tip | src | demo Src | demo Download | | Window | src| demo Src | demo Download |

It is usual to mount different components over the same node for example

  • Mount tooltip
    
  • Mount magnifier
    
  • Mount double click
    

which will result in code like:

     Button button;
		
     new ButtonMagnifier<>(button).mount();
     new Tip<>(button, "Button with Tip").mount();
     new DoubleClickable<>(button, this::OnDoubleClick).mount();

To avoid pass always the same node and invoke mount for all components there is ComponentMounter and some extensions (which can be seen on table bellow) like ButtonMounter. This components permit to chain various components and mount them over the same node. This classes permits to write the equivalent to the above code like:

     Button button;
		
     new  ButtonMounter<>(button)
          .buttonMagnifier()
          .tip("Button with Tip")
          .doubleClickable(this::onDoubleClick)
          .mount();

All mounter components existent:

Component src demo
ButtonMounter src demo Src
ComponentMounter src demo Src
ControlMounter src demo Src
ImagetMounter src demo Src

Clone this wiki locally