Javafx stage resizeable false and maximized true hide taskbar

In my JavaFX FXML application, when I set the resizable value to false and maximize to true, the window becomes maximized, but the taskbar is hidden. I am using Netbeans 8.0.2 for Windows 7 64 bit with JDK 1.8.60

At Netbeans, I followed the steps to create a new JavaFX FXML application. For the default generated code, I added the following two lines to the launch function.

stage.setResizable(false);
stage.setMaximized(true);

Therefore, the final start function is lower

public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().
        getResource("FXMLDocument.fxml"));

    Scene scene = new Scene(root);

    stage.setScene(scene);
    stage.setResizable(false);
    stage.setMaximized(true);
    stage.show();
}

Now, when I launch the application, the window is maximized, the title bar is visible, but the taskbar is not visible. How can I fix this, i.e. Make taskbar visible?

+4
source share
2 answers

@JC997 , .

setWidth setHeight . setResizeable (false) .

, , ,

Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());

stage.setMaxWidth(primaryScreenBounds.getWidth());
stage.setMinWidth(primaryScreenBounds.getWidth());

stage.setMaxHeight(primaryScreenBounds.getHeight());
stage.setMinHeight(primaryScreenBounds.getHeight());
+2

, , , :

Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());

, .

+1

All Articles