Created
May 23, 2019 07:57
-
-
Save elyday/64a0975551fb7121b874491bc6eaef33 to your computer and use it in GitHub Desktop.
Preferences Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package application.preferences; | |
import com.dlsc.preferencesfx.PreferencesFx; | |
import com.dlsc.preferencesfx.model.Category; | |
import com.dlsc.preferencesfx.model.Group; | |
import com.dlsc.preferencesfx.model.Setting; | |
import javafx.beans.property.BooleanProperty; | |
import javafx.beans.property.IntegerProperty; | |
import javafx.beans.property.SimpleBooleanProperty; | |
import javafx.beans.property.SimpleIntegerProperty; | |
import javafx.beans.property.SimpleStringProperty; | |
import javafx.beans.property.StringProperty; | |
class Preferences { | |
private final PreferencesFx preferencesFx; | |
// General | |
private final StringProperty welcomeText = new SimpleStringProperty("Hello World"); | |
private final IntegerProperty brightness = new SimpleIntegerProperty(50); | |
private final BooleanProperty nightMode = new SimpleBooleanProperty(false); | |
Preferences() { | |
this.welcomeText.addListener((observable, oldValue, newValue) -> System.out.println(newValue)); | |
this.preferencesFx = this.createPreferences(); | |
this.preferencesFx.show(true); | |
} | |
private PreferencesFx createPreferences() { | |
return PreferencesFx.of(Preferences.class, Category | |
.of("General", Group.of("Greeting", Setting.of("Welcome Text", this.welcomeText)), Group | |
.of("Display", Setting.of("Brightness", this.brightness), | |
Setting.of("Night mode", this.nightMode)))).persistWindowState(false) | |
.saveSettings(true).debugHistoryMode(false).buttonsVisibility(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment