How to remove JavaFX stage buttons (minimize, maximize, close)

后端 未结 9 1212
你的背包
你的背包 2020-12-05 02:29

How to remove JavaFX stage buttons (minimize, maximize, close)? Can\'t find any according Stage methods, so should I use style for the stage? It\'s necessary fo

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 02:40

    You just have to set a stage's style. Try this example:

    package undecorated;
    
    import javafx.application.Application;
    import javafx.stage.StageStyle;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    
    public class UndecoratedApp extends Application {
    
        public static void main(String[] args) {
            Application.launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            primaryStage.initStyle(StageStyle.UNDECORATED);
    
            Group root = new Group();
            Scene scene = new Scene(root, 100, 100);
    
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    }
    

    When learning JavaFX 2.0 these examples are very helpful.

提交回复
热议问题