Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to disable dialog resize

user10484841Jun 14 2013 — edited Jun 17 2013

I have this example of dialog:

public void aboutDialogPanel()

    {

        final Stage aboutDialog = new Stage();

        aboutDialog.initModality(Modality.WINDOW_MODAL);

        GridPane gridPane = new GridPane();

        gridPane.setPadding(new Insets(10, 10, 10, 10));

        gridPane.setHgap(1);

        gridPane.setVgap(4);

        //gridPane.setStyle("-fx-border-color: red;");

        HBox phbox = new HBox();

        phbox.setAlignment(Pos.CENTER);

        // Image

        ImageView iv = new ImageView(getClass().getResource("/images/splash.png").toExternalForm());

        phbox.getChildren().add(iv);

        gridPane.add(phbox, 0, 0);

        HBox hbox = new HBox();

        // Text Area

        TextArea dataPane = new TextArea();

        dataPane.setEditable(false);

        dataPane.prefWidthProperty().bind(hbox.widthProperty());

        //dataPane.setLayoutX(600);

        //dataPane.setMinWidth(600);

        //dataPane.setLayoutY(560);

        dataPane.setStyle("-fx-border-color: black; -fx-border-width: 1; -fx-border-radius: 6;");

        hbox.setAlignment(Pos.CENTER);

        hbox.setSpacing(1);

        hbox.setPadding(new Insets(10, 0, 10, 0));

        hbox.getChildren().add(dataPane);

        gridPane.add(hbox, 0, 1);

        HBox bhbox = new HBox();

        // Close Button

        Button closeButton = new Button("Close");

        StringBuilder sb = new StringBuilder(300);

        sb.append("-fx-background-color:\nrgba(0,0,0,0.08),\nlinear-gradient(#9a9a9a, #909090),\n");

        sb.append("linear-gradient(white 0%, #f3f3f3 50%, #ececec 51%, #f2f2f2 100%);\n");

        sb.append("-fx-background-insets: 0 0 -1 0,0,1;\n-fx-background-radius: 4,4,3;\n");

        sb.append("-fx-padding: 7 36 6 36;\n-fx-text-fill: #242d35;\n-fx-font-size: 13px;");

        closeButton.setStyle(sb.toString());

        closeButton.setOnAction(new EventHandler<ActionEvent>()

        {

            @Override

            public void handle(ActionEvent arg0)

            {

                // Close the dialog when "Close" button is pressed

                aboutDialog.close();

            }

        });

        bhbox.setAlignment(Pos.CENTER);

        bhbox.setSpacing(10);

        bhbox.setPadding(new Insets(10, 10, 10, 10));

        bhbox.getChildren().add(closeButton);

        gridPane.add(bhbox, 0, 2);

        // Configure dialog size and background color

        Scene aboutDialogScene = new Scene(gridPane, 640, 500, Color.WHITE);

        aboutDialog.setScene(aboutDialogScene);

        aboutDialog.show();

    }

Can you tell me how I can disable the resize of the dialog? Now the user can drag with the mouse the border of the window. I don't want to allow this.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 15 2013
Added on Jun 14 2013
4 comments
923 views