Melowski
Melowski

Reputation: 21

How can I remove stage buttons in JFX

I've tried a lot to remove the stage buttons in my JFX project frame. I'm using a decorator to fresh up the design.

enter image description here

I only want to remove the maximize, resize and minimize buttons. The close button should not be removed. Can you give me a tip, how I can deal with this?

JFXDecorator decorator = new JFXDecorator(primaryStage, gridContainer);

I've tried this to remove the resizable button this way:

primaryStage.setResizable(false);

.jfx-decorator{
    -fx-decorator-color: #2196F3;
    -fx-text-fill: black;
    -fx-background-color: transparent;
    -fx-border-color: #2196F3;
}

.jfx-decorator .jfx-decorator-buttons-container{
    -fx-background-color: -fx-decorator-color;
}

.jfx-decorator .resize-border{
    -fx-border-color: #2196F3;
    -fx-border-width: 0 4 4 4;
}
.jfx-decorator .jfx-decorator-buttons{
    -fx-background-color: red;
}

Upvotes: 0

Views: 377

Answers (2)

Safwan Muhammed
Safwan Muhammed

Reputation: 137

You have to pass the exact number of arguments. boolean values are...

1 full screen

2 Maximize/Restore

3 Minimize

JFXDecorator decorator = new JFXDecorator(mainStage, root, false, false, false);

Upvotes: 3

Melowski
Melowski

Reputation: 21

It is actually pretty simple. If you take a look into the constructor of the decorator:

public JFXDecorator(Stage stage, Node node) { this(stage, node, true, true, true); }

You can set the three Boolean values to false, which exceeds to the wanted solution.

Upvotes: 0

Related Questions