Casper TL
Casper TL

Reputation: 348

JavaFX how to apply CSS theme

I've found this JavaFX theme: http://www.guigarage.com/javafx-themes/flatter/

I've been trying for 2 hours now to implement it. But i really don't know how.

Can anyone tell me step-by-step how to activate this theme? I am using Netbeans (JavaFX application) together with JavaFX Scene Builder 2.0

Upvotes: 2

Views: 3404

Answers (1)

ItachiUchiha
ItachiUchiha

Reputation: 36722

You just need to add FlatterFX.style(); in your code after adding the dependency to your project.

Example

public class FlatterExample extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) {
        Button button = new Button("Flatter");
        Scene scene = new Scene(new VBox(button), 300, 250);
        stage.setScene(scene);
        stage.show();
        FlatterFX.style();
    }
}

Screenshot

enter image description here

Upvotes: 5

Related Questions