Example usage for javafx.scene.layout GridPane getColumnConstraints

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

Introduction

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

Prototype

public final ObservableList<ColumnConstraints> getColumnConstraints() 

Source Link

Document

Returns list of column constraints.

Usage

From source file:Main.java

@Override
public void start(final Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 400, 300, Color.WHITE);

    GridPane gridpane = new GridPane();
    ColumnConstraints col1 = new ColumnConstraints();
    col1.setPercentWidth(25);/*from   ww w . j a  v  a2 s  .c  om*/
    ColumnConstraints col2 = new ColumnConstraints();
    col2.setPercentWidth(50);
    ColumnConstraints col3 = new ColumnConstraints();
    col3.setPercentWidth(25);
    gridpane.getColumnConstraints().addAll(col1, col2, col3);

    gridpane.add(new Label("2"), 2, 0);
    gridpane.add(new Label("1"), 1, 0);
    gridpane.add(new Label("0"), 0, 0);

    root.getChildren().add(gridpane);
    primaryStage.setScene(scene);

    primaryStage.show();
}

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 2s . c  om*/

        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:Main.java

private GridPane createGridPane() {
    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(5);// ww w .j a  va  2  s . c o m
    gridpane.setVgap(5);

    ColumnConstraints column1 = new ColumnConstraints(100);
    ColumnConstraints column2 = new ColumnConstraints(50, 150, 300);

    column2.setHgrow(Priority.ALWAYS);
    gridpane.getColumnConstraints().addAll(column1, column2);

    Label fNameLbl = new Label("First Name");
    TextField fNameFld = new TextField();

    Label lNameLbl = new Label("Last Name");
    TextField lNameFld = new TextField();

    Button saveButton = new Button("Save");

    GridPane.setHalignment(fNameLbl, HPos.RIGHT);
    GridPane.setHalignment(lNameLbl, HPos.RIGHT);

    GridPane.setHalignment(fNameFld, HPos.LEFT);
    GridPane.setHalignment(lNameFld, HPos.LEFT);

    GridPane.setHalignment(saveButton, HPos.RIGHT);

    gridpane.add(fNameLbl, 0, 0);
    gridpane.add(fNameFld, 1, 0);

    gridpane.add(lNameLbl, 0, 1);
    gridpane.add(lNameFld, 1, 1);

    gridpane.add(saveButton, 1, 2);

    return gridpane;

}

From source file:de.perdoctus.ebikeconnect.gui.dialogs.LoginDialog.java

@PostConstruct
public void init() {
    final ImageView graphic = new ImageView(
            new Image(getClass().getResource("/app-icon.png").toExternalForm()));
    graphic.setPreserveRatio(true);//from  ww  w  . j  ava 2 s .  c om
    graphic.setFitHeight(64);
    setGraphic(graphic);
    setResizable(true);
    setWidth(400);
    setResizable(false);

    setTitle(rb.getString("dialogTitle"));
    setHeaderText(rb.getString("dialogMessage"));

    final ButtonType loginButtonType = new ButtonType(rb.getString("loginButton"),
            ButtonBar.ButtonData.OK_DONE);
    getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);

    // Create the username and password labels and fields.
    final GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 10, 10, 10));
    grid.setPrefWidth(getWidth());
    grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.NEVER, HPos.LEFT, true));
    grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.ALWAYS, HPos.LEFT, true));

    final String rbUsername = rb.getString(CFG_USERNAME);
    final TextField txtUsername = new TextField();
    txtUsername.setPromptText(rbUsername);
    txtUsername.setText(config.getString(CFG_USERNAME, ""));

    final Label lblUsername = new Label(rbUsername);
    lblUsername.setLabelFor(txtUsername);
    grid.add(lblUsername, 0, 0);
    grid.add(txtUsername, 1, 0);

    final String rbPassword = rb.getString(CFG_PASSWORD);
    final PasswordField txtPassword = new PasswordField();
    txtPassword.setPromptText(rbPassword);
    if (config.getBoolean(CFG_SAVE_PASSWORD, false)) {
        txtPassword.setText(config.getString(CFG_PASSWORD, ""));
    }

    final Label lblPassword = new Label(rbPassword);
    lblPassword.setLabelFor(txtPassword);
    grid.add(lblPassword, 0, 1);
    grid.add(txtPassword, 1, 1);

    final CheckBox cbSavePassword = new CheckBox(rb.getString("save-password"));
    cbSavePassword.setSelected(config.getBoolean(CFG_SAVE_PASSWORD, false));
    grid.add(cbSavePassword, 1, 2);

    getDialogPane().setContent(grid);

    // Enable/Disable login button depending on whether a username was entered.
    final Node loginButton = getDialogPane().lookupButton(loginButtonType);
    loginButton.disableProperty()
            .bind(txtUsername.textProperty().isEmpty().or(txtPassword.textProperty().isEmpty()));

    setResultConverter(buttonType -> {
        if (buttonType == loginButtonType) {
            config.setProperty(CFG_USERNAME, txtUsername.getText());
            config.setProperty(CFG_SAVE_PASSWORD, cbSavePassword.isSelected());
            if (cbSavePassword.isSelected()) {
                config.setProperty(CFG_PASSWORD, txtPassword.getText());
                config.setProperty(CFG_PASSWORD, txtPassword.getText());
            } else {
                config.clearProperty(CFG_PASSWORD);
            }
            return new Credentials(txtUsername.getText(), txtPassword.getText());
        } else {
            return null;
        }
    });

    if (txtUsername.getText().isEmpty()) {
        txtUsername.requestFocus();
    } else {
        txtPassword.requestFocus();
        txtPassword.selectAll();
    }
}

From source file:Main.java

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

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);//from   ww  w.jav a2s . c o  m
    gridpane.setVgap(10);
    ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE);
    ColumnConstraints column2 = new ColumnConstraints(50);
    ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE);
    column1.setHgrow(Priority.ALWAYS);
    column3.setHgrow(Priority.ALWAYS);
    gridpane.getColumnConstraints().addAll(column1, column2, column3);

    Label candidatesLbl = new Label("Candidates");
    GridPane.setHalignment(candidatesLbl, HPos.CENTER);
    gridpane.add(candidatesLbl, 0, 0);

    Label selectedLbl = new Label("selected");
    gridpane.add(selectedLbl, 2, 0);
    GridPane.setHalignment(selectedLbl, HPos.CENTER);

    // Candidates
    final ObservableList<String> candidates = FXCollections.observableArrayList("Z", "A", "B", "C", "D");
    final ListView<String> candidatesListView = new ListView<>(candidates);
    gridpane.add(candidatesListView, 0, 1);

    final ObservableList<String> selected = FXCollections.observableArrayList();
    final ListView<String> heroListView = new ListView<>(selected);
    gridpane.add(heroListView, 2, 1);

    Button sendRightButton = new Button(" > ");
    sendRightButton.setOnAction((ActionEvent event) -> {
        String potential = candidatesListView.getSelectionModel().getSelectedItem();
        if (potential != null) {
            candidatesListView.getSelectionModel().clearSelection();
            candidates.remove(potential);
            selected.add(potential);
        }
    });

    Button sendLeftButton = new Button(" < ");
    sendLeftButton.setOnAction((ActionEvent event) -> {
        String s = heroListView.getSelectionModel().getSelectedItem();
        if (s != null) {
            heroListView.getSelectionModel().clearSelection();
            selected.remove(s);
            candidates.add(s);
        }
    });
    VBox vbox = new VBox(5);
    vbox.getChildren().addAll(sendRightButton, sendLeftButton);

    gridpane.add(vbox, 1, 1);
    root.setCenter(gridpane);

    GridPane.setVgrow(root, Priority.ALWAYS);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

private GridPane createGridPane() {
    final GridPane gp = new GridPane();
    gp.setPadding(new Insets(10));
    gp.setHgap(20);//from   w  w  w .j  a  va2 s.c  o m
    //gp.add(albumCover, 0, 0, 1, GridPane.REMAINING);
    gp.add(title, 1, 0);
    gp.add(artist, 1, 1);
    gp.add(album, 1, 2);
    gp.add(year, 1, 3);

    final ColumnConstraints c0 = new ColumnConstraints();
    final ColumnConstraints c1 = new ColumnConstraints();
    c1.setHgrow(Priority.ALWAYS);
    gp.getColumnConstraints().addAll(c0, c1);

    final RowConstraints r0 = new RowConstraints();
    r0.setValignment(VPos.TOP);
    gp.getRowConstraints().addAll(r0, r0, r0, r0);

    return gp;
}

From source file:Main.java

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

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);/*  w w w  .  j  a  v  a  2s.co  m*/
    gridpane.setVgap(10);

    ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE);
    ColumnConstraints column2 = new ColumnConstraints(50);
    ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE);

    column1.setHgrow(Priority.ALWAYS);
    column3.setHgrow(Priority.ALWAYS);

    gridpane.getColumnConstraints().addAll(column1, column2, column3);

    // Candidates label
    Label candidatesLbl = new Label("Candidates");
    GridPane.setHalignment(candidatesLbl, HPos.CENTER);
    gridpane.add(candidatesLbl, 0, 0);

    // Heroes label
    Label heroesLbl = new Label("Letters");
    gridpane.add(heroesLbl, 2, 0);
    GridPane.setHalignment(heroesLbl, HPos.CENTER);

    final ObservableList<String> candidates = FXCollections.observableArrayList("A", "B", "C", "D");

    final ListView<String> candidatesListView = new ListView<>(candidates);
    gridpane.add(candidatesListView, 0, 1);

    final ObservableList<String> heroes = FXCollections.observableArrayList();
    final ListView<String> heroListView = new ListView<>(heroes);
    gridpane.add(heroListView, 2, 1);

    Button sendRightButton = new Button(" > ");
    sendRightButton.setOnAction((ActionEvent event) -> {
        String potential = candidatesListView.getSelectionModel().getSelectedItem();
        if (potential != null) {
            candidatesListView.getSelectionModel().clearSelection();
            candidates.remove(potential);
            heroes.add(potential);
        }
    });

    Button sendLeftButton = new Button(" < ");
    sendLeftButton.setOnAction((ActionEvent event) -> {
        String notHero = heroListView.getSelectionModel().getSelectedItem();
        if (notHero != null) {
            heroListView.getSelectionModel().clearSelection();
            heroes.remove(notHero);
            candidates.add(notHero);
        }
    });

    // place the buttons
    VBox vbox = new VBox(5);
    vbox.setAlignment(Pos.CENTER);
    vbox.getChildren().addAll(sendRightButton, sendLeftButton);

    GridPane.setHalignment(vbox, HPos.CENTER);
    gridpane.add(vbox, 1, 1);

    // place the grid
    root.setCenter(gridpane);
    GridPane.setVgrow(root, Priority.ALWAYS);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:eu.ggnet.dwoss.receipt.shipment.ShipmentUpdateStage.java

private void init(Shipment s) {

    okButton.setOnAction((ActionEvent event) -> {
        shipment = getShipment();//from   w w w.j a v a 2s .  co m
        if (isValid())
            close();
    });

    cancelButton.setOnAction((ActionEvent event) -> {
        close();
    });

    idField = new TextField(Long.toString(s.getId()));
    idField.setDisable(true);
    shipIdField = new TextField(s.getShipmentId());

    Callback<ListView<TradeName>, ListCell<TradeName>> cb = new Callback<ListView<TradeName>, ListCell<TradeName>>() {
        @Override
        public ListCell<TradeName> call(ListView<TradeName> param) {
            return new ListCell<TradeName>() {
                @Override
                protected void updateItem(TradeName item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item == null || empty)
                        setText("Hersteller whlen...");
                    else
                        setText(item.getName());
                }
            };
        }
    };

    Set<TradeName> contractors = Client.lookup(MandatorSupporter.class).loadContractors().all();
    ownerBox = new ComboBox<>(FXCollections.observableArrayList(contractors));
    ownerBox.setMaxWidth(MAX_VALUE);
    ownerBox.setCellFactory(cb);
    ownerBox.getSelectionModel().selectedItemProperty().addListener(
            (ObservableValue<? extends TradeName> observable, TradeName oldValue, TradeName newValue) -> {
                if (newValue == null)
                    return;
                shipment.setContractor(newValue);
                manufacturerBox.getSelectionModel().select(newValue.getManufacturer());
            });

    ObservableList<TradeName> manufacturers = FXCollections.observableArrayList(TradeName.getManufacturers());
    manufacturerBox = new ComboBox<>(manufacturers);
    manufacturerBox.setMaxWidth(MAX_VALUE);
    manufacturerBox.setCellFactory(cb);
    SingleSelectionModel<TradeName> sm = ownerBox.getSelectionModel();
    if (s.getContractor() == null)
        sm.selectFirst();
    else
        sm.select(s.getContractor());
    if (shipment.getDefaultManufacturer() != null)
        manufacturerBox.getSelectionModel().select(shipment.getDefaultManufacturer());

    statusBox = new ComboBox<>(FXCollections.observableArrayList(Shipment.Status.values()));
    statusBox.setMaxWidth(MAX_VALUE);
    statusBox.getSelectionModel().select(s.getStatus() == null ? OPENED : s.getStatus());

    GridPane grid = new GridPane();
    grid.addRow(1, new Label("ID:"), idField);
    grid.addRow(2, new Label("Shipment ID:"), shipIdField);
    grid.addRow(3, new Label("Besitzer:"), ownerBox);
    grid.addRow(4, new Label("Hersteller:"), manufacturerBox);
    grid.addRow(5, new Label("Status"), statusBox);
    grid.setMaxWidth(MAX_VALUE);
    grid.vgapProperty().set(2.);
    grid.getColumnConstraints().add(0,
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.SOMETIMES, HPos.LEFT, false));
    grid.getColumnConstraints().add(1,
            new ColumnConstraints(100, 150, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true));

    HBox hButtonBox = new HBox(okButton, cancelButton);
    hButtonBox.alignmentProperty().set(Pos.TOP_RIGHT);

    errorLabel.setWrapText(true);
    BorderPane rootPane = new BorderPane(grid, errorLabel, null, hButtonBox, null);

    this.setTitle(s.getId() > 0 ? "Shipment bearbeiten" : "Shipment anlegen");
    this.setScene(new Scene(rootPane));
    this.setResizable(false);
}

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

private void startSetupWindow(Stage primaryStage) {
    try {/* w w  w  .  j  a v a2s .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:de.pixida.logtest.designer.logreader.LogReaderEditor.java

private void createDialogItems() {
    Validate.notNull(this.logReader); // Will be used to initialize input field values

    // CHECKSTYLE:OFF Yes, we are using lots of constants here. It does not make sense to name them using final variables.
    final GridPane gp = new GridPane();
    gp.setAlignment(Pos.BASELINE_LEFT);/*from   w ww  .  ja  v a2s.  c o m*/
    gp.setHgap(10d);
    gp.setVgap(15d);
    gp.setPadding(new Insets(5d));
    final ColumnConstraints column1 = new ColumnConstraints();
    final ColumnConstraints column2 = new ColumnConstraints();
    column1.setHgrow(Priority.NEVER);
    column2.setHgrow(Priority.SOMETIMES);
    gp.getColumnConstraints().addAll(column1, column2);
    this.insertConfigItemsIntoGrid(gp, this.createConfigurationForm());
    final TitledPane configPane = new TitledPane("Edit Configuration", gp);
    configPane.setGraphic(Icons.getIconGraphics("pencil"));
    configPane.setCollapsible(false);

    final VBox lines = this.createRunForm();
    final TitledPane testPane = new TitledPane("Test Configuration", lines);
    testPane.setGraphic(Icons.getIconGraphics("script_go"));
    testPane.setCollapsible(false);

    final VBox panes = new VBox(configPane, testPane);
    panes.setSpacing(10d);
    final ScrollPane sp = new ScrollPane(panes);
    sp.setPadding(new Insets(10d));
    sp.setFitToWidth(true);
    this.setCenter(sp);
    // CHECKSTYLE:ON
}