How to create a Javafx Window without the three standard buttons (Minimize, Maximize and Close)?

Asked

Viewed 1,624 times

0

It’s basically what this question, I wanted a screen without these 3 buttons,let’s say that without that border that comes standard in basically all windows that opens, and that comes with these 3 buttons, and that starts on full screen. I searched the net and found nothing like it.Ideas?

  • What have you tried?

  • So, nothing kkkkkk pq did not find anything that could remove it. Or appeared from other languages , or unrelated coiisas.

  • 1

    @RORSCHACH the question seems very short, but it is totally possible to answer, he is not necessary to want to change something, but rather to do something based on the Javafx API, just as Deins answered.

1 answer

3


You can define the style using the method initStyle() who receives a Stagestyle of your Stage.

Ex.:

public class HelloWorld extends Application {

    @Override
    public void start(Stage stage) {
        Text text = new Text(10, 40, "Hello World!");
        text.setFont(new Font(40));
        Scene scene = new Scene(new Group(text));

        stage.initStyle(StageStyle.UNDECORATED)

        stage.setTitle("Welcome to JavaFX!"); 
        stage.setScene(scene); 
        stage.sizeToScene(); 
        stage.show(); 
    }

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

The possible values are:

DECORATED

Defines a normal Stage style with a Solid white background and Platform decorations.

Defines a stage style with a solid white background


TRANSPARENT

Defines a Stage style with a Transparent background and no decorations.

Defines a stage style with a transparent background and decorations.


UNDECORATED

Defines a Stage style with a Solid white background and no decorations.

Defines a stage style with a white background and no decorations


UNIFIED

Defines a Stage style with Platform decorations and eliminates the border between client area and decorations.

Defines a stage style with decorations and eliminates the edge between the client area and the decorations


UTILITY

Defines a Stage style with a Solid white background and minimal Platform decorations used for a Utility window.

Defines a stage style with a solid white background and minimal decorations used by a utility screen.


To leave in full screen, you can call the method setFullScreen(Boolean value), true to start full screen, false otherwise

  • 1

    Oops thank you so much, it worked mt well, and that’s just what I needed. Thanks for that.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.