How to remove only the Minimize button from stage components and how to configure components in JavaFX?

How can I remove only the Minimize button from the scene components and how to configure it in JavaFX? I am using Netbeans 7.1.2 and have created a simple JavaFX application. I have a stage primaryStage object. How can i achieve this?

+2
javafx-2
Oct. 16 '12 at 10:27
source share
2 answers

Unfortunately, JavaFX 2.2 does not yet provide an API for controlling system window buttons.

Although you can achieve this by removing system controls with

primaryStage.initStyle(StageStyle.UNDECORATED) 

and providing your own to maximize, close, etc.

You can find an example in the standard sample named Ensemble that follows the described approach: http://www.oracle.com/technetwork/java/javafx/samples/index.html

+2
Oct 17 '12 at 14:21
source share

You can do it like this:

  public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("sample.fxml")); Parent root = (Parent) loader.load(); primaryStage.setResizable(false); primaryStage.initStyle(StageStyle.DECORATED); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root)); primaryStage.show(); } 

Key setResizable (false)

+2
Jul 02 '13 at 7:45
source share



All Articles