Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.07 KB

README.md

File metadata and controls

27 lines (21 loc) · 1.07 KB

JavaFX Day-Night Toggle-Button

JavaFX Day-Night Toggle Button - Custom Control implemented with JavaFX

'Preview'

How to implement?

  1. Copy DayNightToggleButton.java and style.css in your Java FX Project. Be sure that you have a Java JDK installed which includes JavaFX.

  2. Create your business related presentation model with a property for the day-night toggle button

    private final BooleanProperty isDay = new SimpleBooleanProperty();
  3. Create an instance of the day-night toggle button and pass it to your ui

    // Declaration custom control
    private DayNightToggleButton dayNightToggleCustomControl;
    
    // Init custom control
    dayNightToggleCustomControl = new DayNightToggleButton();
  4. Setup all relevant property bindings

    dayNightToggleCustomControl.isToggledProperty().bindBidirectional(pm.isDayProperty());
  5. Have fun 🎉