Example usage for javafx.scene.layout GridPane setColumnSpan

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

Introduction

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

Prototype

public static void setColumnSpan(Node child, Integer value) 

Source Link

Document

Sets the column span for the child when contained by a gridpane so that it will span that number of columns horizontally.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);// www .  j a v  a2s  .c om

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(2);
    grid.setHgap(5);

    scene.setRoot(grid);

    caption.setFont(Font.font("Verdana", 20));

    GridPane.setConstraints(caption, 0, 0);
    GridPane.setColumnSpan(caption, 8);
    grid.getChildren().add(caption);

    final Separator sepHor = new Separator();
    sepHor.setValignment(VPos.CENTER);
    GridPane.setConstraints(sepHor, 0, 1);
    GridPane.setColumnSpan(sepHor, 7);
    grid.getChildren().add(sepHor);

    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 180, 250);

    String[] keys = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#" };

    GridPane numPad = new GridPane();
    for (int i = 0; i < 12; i++) {
        Button button = new Button(keys[i]);
        button.getStyleClass().add("num-button");
        numPad.add(button, i % 3, (int) Math.ceil(i / 3));
    }/*  w  w w  .  j  a  v a  2 s .c om*/

    Button call = new Button("Call");
    call.setId("call-button");
    call.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    numPad.add(call, 0, 4);

    GridPane.setColumnSpan(call, 3);
    GridPane.setHgrow(call, Priority.ALWAYS);

    root.setCenter(numPad);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addHeadLine() {
    if (headLine != null) {
        ++rowIndex;/*from   ww w  . ja  va 2 s.c om*/

        headLineLabel = new Label(BSResources.get(headLine));
        headLineLabel.setMouseTransparent(true);

        if (headlineStyle != null)
            headLineLabel.setStyle(headlineStyle);

        GridPane.setHalignment(headLineLabel, HPos.LEFT);
        GridPane.setRowIndex(headLineLabel, rowIndex);
        GridPane.setColumnSpan(headLineLabel, 2);
        gridPane.getChildren().addAll(headLineLabel);
    }
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addSeparator() {
    if (headLine != null) {
        Separator separator = new Separator();
        separator.setMouseTransparent(true);
        separator.setOrientation(Orientation.HORIZONTAL);
        separator.setStyle("-fx-background: #ccc;");
        GridPane.setHalignment(separator, HPos.CENTER);
        GridPane.setRowIndex(separator, ++rowIndex);
        GridPane.setColumnSpan(separator, 2);

        gridPane.getChildren().add(separator);
    }// w  w  w .j ava  2  s  . c o m
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addMessage() {
    if (message != null) {
        messageLabel = new Label(truncatedMessage);
        messageLabel.setMouseTransparent(true);
        messageLabel.setWrapText(true);//from w  w w.j  a  v  a2 s  .c  om
        GridPane.setHalignment(messageLabel, HPos.LEFT);
        GridPane.setHgrow(messageLabel, Priority.ALWAYS);
        GridPane.setMargin(messageLabel, new Insets(3, 0, 0, 0));
        GridPane.setRowIndex(messageLabel, ++rowIndex);
        GridPane.setColumnIndex(messageLabel, 0);
        GridPane.setColumnSpan(messageLabel, 2);
        gridPane.getChildren().add(messageLabel);
    }
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addBusyAnimation() {
    busyAnimation = new BusyAnimation();
    GridPane.setHalignment(busyAnimation, HPos.CENTER);
    GridPane.setRowIndex(busyAnimation, ++rowIndex);
    GridPane.setColumnSpan(busyAnimation, 2);
    gridPane.getChildren().add(busyAnimation);
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addCloseButton() {
    closeButton = new Button(closeButtonText == null ? "Close" : closeButtonText);
    closeButton.setOnAction(event -> doClose());

    if (actionHandlerOptional.isPresent() || actionButtonText != null) {
        actionButton = new Button(actionButtonText == null ? "Ok" : actionButtonText);
        actionButton.setDefaultButton(true);
        //TODO app wide focus
        //actionButton.requestFocus();
        actionButton.setOnAction(event -> {
            hide();/*from   w w  w . j  av a  2 s  .c o  m*/
            actionHandlerOptional.ifPresent(Runnable::run);
        });

        Pane spacer = new Pane();
        HBox hBox = new HBox();
        hBox.setSpacing(10);
        hBox.getChildren().addAll(spacer, closeButton, actionButton);
        HBox.setHgrow(spacer, Priority.ALWAYS);

        GridPane.setHalignment(hBox, HPos.RIGHT);
        GridPane.setRowIndex(hBox, ++rowIndex);
        GridPane.setColumnSpan(hBox, 2);
        GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0));
        gridPane.getChildren().add(hBox);
    } else if (!hideCloseButton) {
        closeButton.setDefaultButton(true);
        GridPane.setHalignment(closeButton, HPos.RIGHT);
        if (!showReportErrorButtons)
            GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0));
        GridPane.setRowIndex(closeButton, ++rowIndex);
        GridPane.setColumnIndex(closeButton, 1);
        gridPane.getChildren().add(closeButton);
    }
}