Example usage for javafx.scene.layout GridPane setHalignment

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

Introduction

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

Prototype

public static void setHalignment(Node child, HPos value) 

Source Link

Document

Sets the horizontal alignment for the child when contained by a gridpane.

Usage

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

private void addReportErrorButtons() {
    messageLabel.setText(truncatedMessage
            + "\n\nTo help us to improve the software please report the bug at our issue tracker at Github or send it by email to the developers.\n"
            + "The error message will be copied to clipboard when you click the below buttons.\n"
            + "It will make debugging easier if you can attach the bitsquare.log file which you can find in the application directory.");

    Button githubButton = new Button("Report to Github issue tracker");
    GridPane.setMargin(githubButton, new Insets(20, 0, 0, 0));
    GridPane.setHalignment(githubButton, HPos.RIGHT);
    GridPane.setRowIndex(githubButton, ++rowIndex);
    GridPane.setColumnIndex(githubButton, 1);
    gridPane.getChildren().add(githubButton);

    githubButton.setOnAction(event -> {
        Utilities.copyToClipboard(message);
        GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues");
    });/*from   www  . j  a v a2  s.  co m*/

    Button mailButton = new Button("Report by email");
    GridPane.setHalignment(mailButton, HPos.RIGHT);
    GridPane.setRowIndex(mailButton, ++rowIndex);
    GridPane.setColumnIndex(mailButton, 1);
    gridPane.getChildren().add(mailButton);
    mailButton.setOnAction(event -> {
        Utilities.copyToClipboard(message);
        GUIUtil.openMail("manfred@bitsquare.io", "Error report", "Error message:\n" + message);
    });
}

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 addDontShowAgainCheckBox() {
    if (dontShowAgainId != null && preferences != null) {
        if (dontShowAgainText == null)
            dontShowAgainText = "Don't show again";
        CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, dontShowAgainText, buttonDistance - 1);
        GridPane.setColumnIndex(dontShowAgainCheckBox, 0);
        GridPane.setHalignment(dontShowAgainCheckBox, HPos.LEFT);
        dontShowAgainCheckBox.setOnAction(
                e -> preferences.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected()));
    }// w ww.ja va 2  s  . com
}

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();//www.ja v  a  2s . co 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);
    }
}

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

protected BarChart<String, Number> createChart() {

    this.xAxis = new CategoryAxis();
    this.yAxis = new NumberAxis();
    this.yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(this.yAxis, "$", null));
    this.bc = new BarChart<String, Number>(this.xAxis, this.yAxis);
    this.bc.setAnimated(true);
    this.bc.setTitle(" ");

    this.xAxis.getStyleClass().add("jacp-bar");
    this.yAxis.getStyleClass().add("jacp-bar");
    this.xAxis.setLabel("Year");
    this.yAxis.setLabel("Price");

    this.series1 = new XYChart.Series<String, Number>();
    this.series1.setName("electronic");
    this.series2 = new XYChart.Series<String, Number>();
    this.series2.setName("clothes");
    this.series3 = new XYChart.Series<String, Number>();
    this.series3.setName("hardware");
    this.series4 = new XYChart.Series<String, Number>();
    this.series4.setName("books");

    GridPane.setHalignment(this.bc, HPos.CENTER);
    GridPane.setVgrow(this.bc, Priority.ALWAYS);
    GridPane.setHgrow(this.bc, Priority.ALWAYS);
    GridPane.setMargin(this.bc, new Insets(0, 6, 0, 0));
    return this.bc;
}

From source file:org.mskcc.shenkers.control.alignment.AlignmentOverlay.java

private void populateGridPane() {
    ObservableList<Node> children = this.getChildren();
    children.clear();/*from   w  w w  . j av  a2  s  .  co m*/
    int l = nodes.size();
    boolean flip = flipProperty.get();

    for (int i = 0; i < l; i++) {
        Node n = nodes.get(i);
        GridPane.setHalignment(n, HPos.CENTER);
        GridPane.setValignment(n, VPos.CENTER);
        GridPane.setHgrow(n, Priority.ALWAYS);
        GridPane.setVgrow(n, Priority.ALWAYS);
        GridPane.setRowIndex(n, 0);
        GridPane.setColumnIndex(n, flip ? l - i - 1 : i);
        children.add(n);
    }
}