Example usage for javafx.scene.layout GridPane GridPane

List of usage examples for javafx.scene.layout GridPane GridPane

Introduction

In this page you can find the example usage for javafx.scene.layout GridPane GridPane.

Prototype

public GridPane() 

Source Link

Document

Creates a GridPane layout with hgap/vgap = 0 and TOP_LEFT alignment.

Usage

From source file:org.blockedit.utils.ExceptionDialog.java

/**
 * Create a exception alert that is displayed to the user.
 *
 * @param message The message to show the user
 * @param title The title of the window/* ww  w . j  av a  2  s .c  o  m*/
 * @param header The message header
 * @param exception The exception that triggered this window to be displayed to the user
 * @return A created alert
 */
private static Alert createDialog(String message, String title, String header, Exception exception) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(message);
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    String exceptionText = ExceptionUtils.getStackTrace(exception);
    exception.printStackTrace();
    Label label = new Label("The exception stacktrace was:");
    TextArea exceptionArea = new TextArea(
            exceptionText + "\n\n==User Information==\njava.version = " + System.getProperty("java.version")
                    + "\nos.name = " + System.getProperty("os.name") + "\nos.arch = "
                    + System.getProperty("os.arch") + "\nos.version = " + System.getProperty("os.version"));
    exceptionArea.setEditable(false);
    exceptionArea.setWrapText(true);
    exceptionArea.setMaxWidth(UserInformation.getWindowWidth() / 2);
    exceptionArea.setMaxHeight(UserInformation.getWindowHeight() / 2);
    GridPane.setVgrow(exceptionArea, Priority.ALWAYS);
    GridPane.setHgrow(exceptionArea, Priority.ALWAYS);
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(UserInformation.getWindowWidth() / 2);
    expContent.add(label, 0, 0);
    expContent.add(exceptionArea, 0, 1);
    alert.getDialogPane().setExpandableContent(expContent);
    return alert;
}

From source file:com.canoo.dolphin.todo.client.ToDoClient.java

private void showError(String header, String content, Exception e) {
    e.printStackTrace();//from   www  . ja  v  a  2 s.co  m

    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle("Error");
    alert.setHeaderText(header);
    alert.setContentText(content);

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    alert.getDialogPane().setExpandableContent(expContent);
    alert.showAndWait();
    System.exit(-1);
}

From source file:dsfixgui.view.DSFSavesPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);//from   w  w  w . jav  a 2  s .c  o  m
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(SAVE_BACKUP.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().add("settings_title");
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Toggle Save Backups
    saveBackupsPane = new FlowPane();
    saveBackupsPane.getStyleClass().add("settings_pane");
    saveBackupsLabel = new Label(SAVE_BACKUPS_LABEL + "  ");
    saveBackupsLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    saveBackupsPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableBackups.get() == 0) {
        saveBackupsPicker.setValue(saveBackupsPicker.getItems().get(0));
    } else {
        saveBackupsPicker.setValue(saveBackupsPicker.getItems().get(1));
    }
    saveBackupsPane.getChildren().addAll(saveBackupsLabel, saveBackupsPicker);
    //
    //Save Backup Interval
    saveIntervalPane = new FlowPane();
    saveIntervalPane.getStyleClass().add("settings_pane");
    saveIntervalLabel = new Label(SAVE_BACKUPS_INTERVAL_LABEL + " ");
    saveIntervalLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    saveIntervalLabel.setTooltip(new Tooltip(SAVE_INTERVAL_TT));
    saveIntervalField = new TextField("" + config.backupInterval.get());
    saveIntervalField.getStyleClass().add("settings_text_field");
    saveIntervalPane.getChildren().addAll(saveIntervalLabel, saveIntervalField);
    //
    //Max Save Backups
    maxSavesPane = new FlowPane();
    maxSavesPane.getStyleClass().add("settings_pane");
    maxSavesLabel = new Label(MAX_BACKUPS_LABEL + " ");
    maxSavesLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    maxSavesField = new TextField("" + config.maxBackups.get());
    maxSavesField.getStyleClass().add("settings_text_field");
    maxSavesPane.getChildren().addAll(maxSavesLabel, maxSavesField);

    if (config.enableBackups.get() == 0) {
        saveIntervalField.setDisable(true);
        maxSavesField.setDisable(true);
    }

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, saveBackupsPane,
            saveIntervalPane, maxSavesPane, bottomSpacerHBox);
    initializeEventHandlers();

    this.setContent(primaryPane);
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    final Label label = new Label("Progress:");
    final ProgressBar progressBar = new ProgressBar(0);
    final ProgressIndicator progressIndicator = new ProgressIndicator(0);

    final Button startButton = new Button("Start");
    final Button cancelButton = new Button("Cancel");
    final TextArea textArea = new TextArea();

    startButton.setOnAction((ActionEvent event) -> {
        startButton.setDisable(true);//from w  ww .j  a  v a  2  s . co m

        progressBar.setProgress(0);
        progressIndicator.setProgress(0);

        textArea.setText("");
        cancelButton.setDisable(false);

        copyWorker = createWorker(numFiles);

        progressBar.progressProperty().unbind();
        progressBar.progressProperty().bind(copyWorker.progressProperty());
        progressIndicator.progressProperty().unbind();
        progressIndicator.progressProperty().bind(copyWorker.progressProperty());

        copyWorker.messageProperty().addListener(
                (ObservableValue<? extends String> observable, String oldValue, String newValue) -> {
                    textArea.appendText(newValue + "\n");
                });

        new Thread(copyWorker).start();
    });

    cancelButton.setOnAction((ActionEvent event) -> {
        startButton.setDisable(false);
        cancelButton.setDisable(true);
        copyWorker.cancel(true);

        progressBar.progressProperty().unbind();
        progressBar.setProgress(0);
        progressIndicator.progressProperty().unbind();
        progressIndicator.setProgress(0);
        textArea.appendText("File transfer was cancelled.");
    });

    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 500, 250, javafx.scene.paint.Color.WHITE);

    FlowPane topPane = new FlowPane(5, 5);
    topPane.setPadding(new Insets(5));
    topPane.setAlignment(Pos.CENTER);
    topPane.getChildren().addAll(label, progressBar, progressIndicator);

    GridPane middlePane = new GridPane();
    middlePane.setPadding(new Insets(5));
    middlePane.setHgap(20);
    middlePane.setVgap(20);
    ColumnConstraints column1 = new ColumnConstraints(300, 400, Double.MAX_VALUE);
    middlePane.getColumnConstraints().addAll(column1);
    middlePane.setAlignment(Pos.CENTER);
    middlePane.add(textArea, 0, 0);

    FlowPane bottomPane = new FlowPane(5, 5);
    bottomPane.setPadding(new Insets(5));
    bottomPane.setAlignment(Pos.CENTER);
    bottomPane.getChildren().addAll(startButton, cancelButton);

    root.setTop(topPane);
    root.setCenter(middlePane);
    root.setBottom(bottomPane);

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:dsfixgui.view.DSFUnsafeSettingsPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);//from w  w w . ja  v  a  2 s.  c  o  m
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(UNSAFE_OPS.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().addAll("settings_title", "red_text");
    titleLabel.setTooltip(new Tooltip(UNSAFE_TT));
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Force Window Modes
    windowModePane = new FlowPane();
    windowModePane.getStyleClass().add("settings_pane");
    windowModeLabel = new Label(FORCE_WINDOW_MODE_LABEL + "  ");
    windowModeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    windowModeChoice = new ToggleGroup();
    neitherWindowMode = new RadioButton(WINDOW_MODES[0] + "   ");
    neitherWindowMode.setToggleGroup(windowModeChoice);
    forceWindowed = new RadioButton(WINDOW_MODES[1]);
    forceWindowed.setToggleGroup(windowModeChoice);
    forceFullscreen = new RadioButton(WINDOW_MODES[2]);
    forceFullscreen.setToggleGroup(windowModeChoice);
    if (config.forceWindowed.get() == 0 && config.forceFullscreen.get() == 0) {
        neitherWindowMode.setSelected(true);
    } else if (config.forceWindowed.get() == 1) {
        forceWindowed.setSelected(true);
        config.forceFullscreen.set(0);
    } else {
        forceFullscreen.setSelected(true);
    }
    windowModePane.getChildren().addAll(windowModeLabel, neitherWindowMode, forceWindowed, forceFullscreen);
    //
    //Toggle Vsync
    vsyncPane = new FlowPane();
    vsyncPane.getStyleClass().add("settings_pane");
    vsyncLabel = new Label(VSYNC_LABEL + "  ");
    vsyncLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    vsyncLabel.setTooltip(new Tooltip(VSYNC_TT));
    vsyncPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableVsync.get() == 0) {
        vsyncPicker.setValue(vsyncPicker.getItems().get(0));
    } else {
        vsyncPicker.setValue(vsyncPicker.getItems().get(1));
    }
    vsyncPane.getChildren().addAll(vsyncLabel, vsyncPicker);
    //
    //Fullscreen Refresh Rate
    refreshRatePane = new FlowPane();
    refreshRatePane.getStyleClass().add("settings_pane");
    refreshRateLabel = new Label(REFRESH_RATE_LABEL + " ");
    refreshRateLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    refreshRateLabel.setTooltip(new Tooltip(FULLSCREEN_HZ_TT));
    refreshRateField = new TextField("" + config.fullscreenHz.get());
    refreshRateField.getStyleClass().add("settings_text_field");
    refreshRatePane.getChildren().addAll(refreshRateLabel, refreshRateField);
    //

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, windowModePane, vsyncPane,
            refreshRatePane, bottomSpacerHBox);
    initializeEventHandlers();

    this.setContent(primaryPane);
}

From source file:org.jacp.demo.components.ContactChartViewComponent.java

private GridPane createRoot() {
    final GridPane myRoot = new GridPane();
    myRoot.getStyleClass().addAll("dark", "bar-chart-root");
    myRoot.setAlignment(Pos.CENTER);//  w w w.  j  a  v  a  2  s .  c  om
    GridPane.setHgrow(myRoot, Priority.ALWAYS);
    GridPane.setVgrow(myRoot, Priority.ALWAYS);
    return myRoot;
}

From source file:uk.co.everywheremusic.viewcontroller.SetupScene.java

private void startSetupWindow(Stage primaryStage) {
    try {/*from  w w w  .  ja  v a 2 s .c  o m*/
        installFolder = new File(".").getCanonicalPath() + Globals.INSTALL_EXT;
    } catch (IOException ex) {
        Logger.getLogger(SetupScene.class.getName()).log(Level.SEVERE, null, ex);
        installFolder = System.getProperty("user.dir") + Globals.INSTALL_EXT;
    }

    primaryStage.setTitle(Globals.APP_NAME);

    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    column1 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column1.setHgrow(Priority.ALWAYS);
    column2 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column2.setHgrow(Priority.ALWAYS);
    column3 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column3.setHgrow(Priority.ALWAYS);
    column4 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column4.setHgrow(Priority.ALWAYS);
    grid.getColumnConstraints().addAll(column1, column2, column3, column4);

    sceneTitle = new Label(Globals.SETUP_FRAME_TITLE);
    sceneTitle.setId(Globals.CSS_TITLE_ID);
    sceneTitle.setPrefWidth(Double.MAX_VALUE);
    sceneTitle.setAlignment(Pos.CENTER);

    ImageView imageView = null;
    try {

        imageView = new ImageView();
        String img = new File(Globals.IC_LOGO).toURI().toURL().toString();
        imgLogo = new Image(img);

        imageView.setImage(imgLogo);

    } catch (MalformedURLException ex) {
        Logger.getLogger(ServerScene.class.getName()).log(Level.SEVERE, null, ex);
    }

    GridPane titlePane = new GridPane();
    ColumnConstraints c1 = new ColumnConstraints(50);
    ColumnConstraints c2 = new ColumnConstraints(400);
    titlePane.getColumnConstraints().addAll(c1, c2);
    titlePane.add(imageView, 0, 0);
    titlePane.add(sceneTitle, 1, 0);
    titlePane.setAlignment(Pos.CENTER);
    grid.add(titlePane, 0, 0, 4, 1);

    lblFolder = new Label(Globals.SETUP_LBL_MUSIC_FOLDER);
    grid.add(lblFolder, 0, 2, 3, 1);

    txtFolder = new TextField();
    txtFolder.setText("/home/kyle/Music/Test music");
    grid.add(txtFolder, 0, 3, 3, 1);

    btnFolder = new Button(Globals.SETUP_BTN_MUSIC_FOLDER);
    btnFolder.setPrefWidth(Double.MAX_VALUE);
    grid.add(btnFolder, 3, 3);

    final DirectoryChooser dirChooser = new DirectoryChooser();

    btnFolder.setOnAction((ActionEvent event) -> {
        File dir = dirChooser.showDialog(primaryStage);
        if (dir != null) {
            txtFolder.setText(dir.getAbsolutePath());
        }
    });

    lblPassword = new Label("Choose a password:");
    grid.add(lblPassword, 0, 4, 2, 1);

    lblConfirmPassword = new Label("Confirm your password:");
    grid.add(lblConfirmPassword, 2, 4, 2, 1);

    txtPassword = new PasswordField();
    grid.add(txtPassword, 0, 5, 2, 1);

    txtConfirmPassword = new PasswordField();
    grid.add(txtConfirmPassword, 2, 5, 1, 1);

    textArea = new TextArea();
    textArea.setPrefHeight(Double.MAX_VALUE);
    textArea.setDisable(true);
    textArea.setWrapText(true);
    grid.add(textArea, 0, 7, 4, 2);

    StackPane progressPane = new StackPane();
    lblProgress = new Label(Globals.SETUP_LBL_PERCENT);
    lblProgress.setId(Globals.CSS_PROGBAR_LBL_ID);
    lblProgress.setVisible(false);
    progressBar = new ProgressBar(0);
    progressBar.setPrefWidth(Double.MAX_VALUE);
    progressBar.setVisible(false);
    progressPane.getChildren().addAll(progressBar, lblProgress);
    progressPane.setAlignment(Pos.CENTER_RIGHT);
    grid.add(progressPane, 0, 11, 3, 1);

    StackPane buttonPane = new StackPane();
    btnInstall = new Button(Globals.SETUP_BTN_INSTALL);
    btnInstall.setPrefWidth(Double.MAX_VALUE);
    btnDone = new Button(Globals.SETUP_BTN_DONE);
    btnDone.setPrefWidth(Double.MAX_VALUE);
    btnDone.setVisible(false);
    buttonPane.getChildren().addAll(btnInstall, btnDone);
    grid.add(buttonPane, 3, 11);

    btnInstall.setOnAction((ActionEvent event) -> {

        boolean valid = validateForm();
        if (valid) {

            lblFolder.setDisable(true);
            txtFolder.setDisable(true);
            btnFolder.setDisable(true);
            lblPassword.setDisable(true);
            txtPassword.setDisable(true);
            lblConfirmPassword.setDisable(true);
            txtConfirmPassword.setDisable(true);

            textArea.setDisable(false);
            lblProgress.setVisible(true);
            progressBar.setVisible(true);
            btnInstall.setDisable(true);

            musicFolder = txtFolder.getText();
            password = txtPassword.getText();

            setupWorker = createSetupWorker();
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().bind(setupWorker.progressProperty());

            setupWorker.messageProperty().addListener(
                    (ObservableValue<? extends String> observable, String oldValue, String newValue) -> {
                        String[] values = newValue.split("\\|");
                        lblProgress.setText(values[0] + "%");
                        textArea.appendText(values[1] + "\n");

                        if (values[1].equals(Globals.SETUP_MSG_DONE)) {
                            btnInstall.setVisible(false);
                            btnDone.setVisible(true);
                        }

                    });

            new Thread(setupWorker).start();

        }
    });

    btnDone.setOnAction((ActionEvent event) -> {
        primaryStage.hide();
        new ServerScene(installFolder, musicFolder).showWindow(new Stage());
    });

    try {
        String imgUrl = new File(Globals.IC_LOGO).toURI().toURL().toString();
        javafx.scene.image.Image i = new javafx.scene.image.Image(imgUrl);
        primaryStage.getIcons().add(i);
    } catch (MalformedURLException ex) {
        Logger.getLogger(ServerScene.class.getName()).log(Level.SEVERE, null, ex);
    }

    scene = new Scene(grid, 600, 400);
    primaryStage.setScene(scene);

    scene.getStylesheets().add(SetupScene.class.getResource(Globals.CSS_FILE).toExternalForm());
    //  grid.setGridLinesVisible(true);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 500, 250, Color.WHITE);

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);//  w w w .j  a  v  a  2s  . c o m
    gridpane.setVgap(10);
    root.setCenter(gridpane);

    ObservableList<Person> leaders = getPeople();
    final ObservableList<Person> teamMembers = FXCollections.observableArrayList();

    ListView<Person> leaderListView = createLeaderListView(leaders);
    TableView<Person> employeeTableView = createEmployeeTableView(teamMembers);

    Label bossesLbl = new Label("Boss");
    GridPane.setHalignment(bossesLbl, HPos.CENTER);
    gridpane.add(bossesLbl, 0, 0);
    gridpane.add(leaderListView, 0, 1);

    Label emplLbl = new Label("Employees");
    GridPane.setHalignment(emplLbl, HPos.CENTER);
    gridpane.add(emplLbl, 2, 0);
    gridpane.add(employeeTableView, 2, 1);

    leaderListView.getSelectionModel().selectedItemProperty()
            .addListener((ObservableValue<? extends Person> observable, Person oldValue, Person newValue) -> {
                if (observable != null && observable.getValue() != null) {
                    teamMembers.clear();
                    teamMembers.addAll(observable.getValue().employeesProperty());
                }
            });
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:jlotoprint.MainViewController.java

public static void loadAboutWindow() {

    //setup//from   ww  w .ja v a2s.  c o  m
    Dialog dialog = new Dialog<>();
    dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
    dialog.setTitle("About JLotoPanel");
    dialog.setHeaderText("JLotoPanel v1.0");
    ImageView icon = new ImageView("file:resources/icon.png");
    icon.setSmooth(true);
    icon.setFitHeight(48.0);
    icon.setFitWidth(48.0);
    dialog.setGraphic(icon);
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.initOwner(JLotoPrint.stage.getScene().getWindow());
    //content
    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 0, 10));

    //text
    TextArea textArea = new TextArea("For more info, please visit: https://github.com/mbppower/JLotoPanel");
    textArea.setWrapText(true);
    grid.add(textArea, 0, 0);
    dialog.getDialogPane().setContent(grid);

    dialog.showAndWait();
}

From source file:dsfixgui.view.DSFHudPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);//from ww w. j a v a 2  s. c  o  m
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(HUD.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().add("settings_title");
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Toggle HUD Modifications
    hudModsPane = new FlowPane();
    hudModsPane.getStyleClass().add("settings_pane");
    hudModsLabel = new Label(HUD_MODS_LABEL + "  ");
    hudModsLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    hudModsLabel.setTooltip(new Tooltip(HUD_MODS_TT));
    hudModsPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableHudMod.get() == 0) {
        hudModsPicker.setValue(hudModsPicker.getItems().get(0));
    } else {
        hudModsPicker.setValue(hudModsPicker.getItems().get(1));
    }
    hudModsPane.getChildren().addAll(hudModsLabel, hudModsPicker);
    //
    //Minimal HUD
    minimalHUDPane = new FlowPane();
    minimalHUDPane.getStyleClass().add("settings_pane");
    minimalHUDLabel = new Label(MINIMAL_HUD_LABEL + "  ");
    minimalHUDLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    minimalHUDLabel.setTooltip(new Tooltip(MIN_HUD_TT));
    minimalHUDPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableMinimalHud.get() == 0) {
        minimalHUDPicker.setValue(minimalHUDPicker.getItems().get(0));
    } else {
        minimalHUDPicker.setValue(minimalHUDPicker.getItems().get(1));
    }
    minimalHUDPane.getChildren().addAll(minimalHUDLabel, minimalHUDPicker);
    //
    //HUD Scale
    hudScalePane = new FlowPane();
    hudScalePane.getStyleClass().add("settings_pane");
    hudScaleLabel = new Label(HUD_SCALE_LABEL + "  ");
    hudScaleLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    hudScaleLabel.setTooltip(new Tooltip(HUD_SCALE_TT));
    hudScaleField = new TextField(config.hudScaleFactor.toString());
    hudScaleField.getStyleClass().add("settings_med_text_field");
    hudScalePane.getChildren().addAll(hudScaleLabel, hudScaleField);
    //
    //HUD Opacities Parent Label
    hudOpacitiesPane = new FlowPane();
    hudOpacitiesPane.getStyleClass().add("settings_pane");
    hudOpacitiesLabel = new Label(HUD_OPACITIES_LABEL + "  ");
    hudOpacitiesLabel.getStyleClass().addAll("bold_text", "font_14_pt");
    hudOpacitiesLabel.setTooltip(new Tooltip(HUD_OPS_TT));
    hudOpacitiesPane.getChildren().addAll(hudOpacitiesLabel);
    //
    //Top Left HUD Opacity
    topLeftHUDOpPane = new FlowPane();
    topLeftHUDOpPane.getStyleClass().add("settings_pane");
    topLeftHUDOpLabel = new Label(TOP_LEFT_HUD_OP_LABEL + "  ");
    topLeftHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    topLeftHUDOpLabel.setTooltip(new Tooltip(TOP_LEFT_HUD_TT));
    topLeftHUDOpField = new TextField(
            config.hudTopLeftOpacity.toString().substring(0, config.hudTopLeftOpacity.length() - 1));
    topLeftHUDOpField.getStyleClass().add("settings_med_text_field");
    topLeftHUDOpPane.getChildren().addAll(topLeftHUDOpLabel, topLeftHUDOpField);
    //
    //Bottom Left HUD Opacity
    bottomLeftHUDOpPane = new FlowPane();
    bottomLeftHUDOpPane.getStyleClass().add("settings_pane");
    bottomLeftHUDOpLabel = new Label(BOTTOM_LEFT_HUD_OP_LABEL + "  ");
    bottomLeftHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    bottomLeftHUDOpLabel.setTooltip(new Tooltip(BOTTOM_LEFT_HUD_TT));
    bottomLeftHUDOpField = new TextField(
            config.hudBottomLeftOpacity.toString().substring(0, config.hudBottomLeftOpacity.length() - 1));
    bottomLeftHUDOpField.getStyleClass().add("settings_med_text_field");
    bottomLeftHUDOpPane.getChildren().addAll(bottomLeftHUDOpLabel, bottomLeftHUDOpField);
    //
    //Bottom Riht HUD Opacity
    bottomRightHUDOpPane = new FlowPane();
    bottomRightHUDOpPane.getStyleClass().add("settings_pane");
    bottomRightHUDOpLabel = new Label(BOTTOM_RIGHT_HUD_OP_LABEL + "  ");
    bottomRightHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    bottomRightHUDOpLabel.setTooltip(new Tooltip(BOTTOM_RIGHT_HUD_TT));
    bottomRightHUDOpField = new TextField(
            config.hudBottomRightOpacity.toString().substring(0, config.hudBottomRightOpacity.length() - 1));
    bottomRightHUDOpField.getStyleClass().add("settings_med_text_field");
    bottomRightHUDOpPane.getChildren().addAll(bottomRightHUDOpLabel, bottomRightHUDOpField);

    if (config.enableHudMod.get() == 0) {
        minimalHUDPicker.setDisable(true);
        hudScaleField.setDisable(true);
        topLeftHUDOpField.setDisable(true);
        bottomLeftHUDOpField.setDisable(true);
        bottomRightHUDOpField.setDisable(true);
    }

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, hudModsPane, minimalHUDPane,
            hudScalePane, hudOpacitiesPane, topLeftHUDOpPane, bottomLeftHUDOpPane, bottomRightHUDOpPane,
            bottomSpacerHBox);

    initializeEventHandlers();

    this.setContent(primaryPane);
}