Example usage for javafx.scene.layout BorderPane setCenter

List of usage examples for javafx.scene.layout BorderPane setCenter

Introduction

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

Prototype

public final void setCenter(Node value) 

Source Link

Usage

From source file:Main.java

public static Node createProgressIndicator() {
    ProgressIndicator indicator = new ProgressIndicator();
    indicator.setMaxHeight(350);/*  w w  w.j  av a2 s.c  o  m*/
    indicator.setMaxWidth(350);

    BorderPane borderPane = new BorderPane();
    BorderPane.setMargin(indicator, new Insets(5));
    borderPane.setCenter(indicator);
    borderPane.setStyle("-fx-background-color: rgba(230,230,230,0.7);");
    return borderPane;
}

From source file:eu.ggnet.dwoss.util.OkCancelStage.java

public OkCancelStage(String title, T payload) {
    this.payload = payload;
    BorderPane pane = new BorderPane();
    pane.setCenter(payload);

    Button okButton = new Button("Ok");
    okButton.defaultButtonProperty();// ww w  .  ja  v  a 2s.  co m

    Button cancelButton = new Button("Abbrechen");
    cancelButton.setCancelButton(true);

    HBox bottom = new HBox();
    bottom.setPadding(new Insets(10));
    bottom.getChildren().addAll(okButton, cancelButton);
    pane.setBottom(bottom);
    if (!StringUtils.isBlank(title))
        setTitle(title);
    setScene(new Scene(pane));

    okButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            OkCancelStage.this.ok = true;
            close();
        }
    });
    cancelButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            close();
        }
    });
}

From source file:org.pdfsam.ui.info.InfoStage.java

@Inject
public InfoStage(InfoPane infoPane, Collection<Image> logos, StylesConfig styles) {
    BorderPane containerPane = new BorderPane();
    containerPane.getStyleClass().addAll(Style.CONTAINER.css());
    containerPane.setCenter(infoPane);
    containerPane.setBottom(new ClosePane());
    Scene scene = new Scene(containerPane);
    scene.getStylesheets().addAll(styles.styles());
    scene.setOnKeyReleased(new HideOnEscapeHandler(this));
    setScene(scene);/* w  w  w.  j a  va2  s  . c o m*/
    setTitle(DefaultI18nContext.getInstance().i18n("Document details"));
    getIcons().addAll(logos);
    setMaximized(true);
}

From source file:mesclasses.objects.LoadWindow.java

private Scene createloadingScene() {
    bar = new ProgressBar();
    vbox = new VBox();
    BorderPane p = new BorderPane();
    p.setCenter(bar);
    p.setTop(vbox);/*w  w w.j a v  a 2s. c o m*/
    BorderPane.setAlignment(vbox, Pos.CENTER);
    return new Scene(p, 300, 150);
}

From source file:be.makercafe.apps.makerbench.editors.TextEditor.java

public TextEditor(String tabText, Path path) {
    super(tabText);

    this.caCodeArea = new CodeArea("");
    this.caCodeArea.setEditable(true);
    this.caCodeArea.setParagraphGraphicFactory(LineNumberFactory.get(caCodeArea));
    this.caCodeArea.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);
    addContextMenu(this.caCodeArea);

    try {/*from  w ww . j av a 2s .com*/
        this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile()));
    } catch (IOException ex) {
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex);
    }

    BorderPane rootPane = new BorderPane();

    toolBar = createToolBar();
    rootPane.setTop(toolBar);
    rootPane.setCenter(caCodeArea);
    this.getTab().setContent(rootPane);

}

From source file:com.bdb.weather.display.windrose.WindRosePane.java

/**
 * Constructor./*from   w  ww  . j  av a2s .  co  m*/
 */
public WindRosePane() {
    this.setPrefSize(300, 300);
    ChartFactory.getChartTheme().apply(chart);
    chartViewer.setMinHeight(10);
    chartViewer.setMinWidth(10);
    chartViewer.setPrefSize(300, 300);

    dataTable = new TableView();

    FlowPane summaryPanel = new FlowPane();

    summaryPanel.getChildren().add(new LabeledFieldPane<>("Date:", timeField));
    timeField.setEditable(false);
    summaryPanel.getChildren().add(new LabeledFieldPane<>("% Winds are calm:", calmField));
    calmField.setEditable(false);

    summaryPanel.getChildren().add(new Label("Speeds are in " + Speed.getDefaultUnit()));

    BorderPane p = new BorderPane();

    p.setCenter(dataTable);
    p.setTop(summaryPanel);
    this.setTabContents(chartViewer, p);

    TableColumn<WindSlice, String> headingColumn = new TableColumn<>("Heading");
    headingColumn.setCellValueFactory((rec) -> new ReadOnlyStringWrapper(
            Heading.headingForSlice(rec.getValue().getHeadingIndex(), 16).getCompassLabel()));
    dataTable.getColumns().add(headingColumn);

    TableColumn<WindSlice, String> percentOfWindColumn = new TableColumn<>("% of Wind");
    percentOfWindColumn.setCellValueFactory(
            (rec) -> new ReadOnlyStringWrapper(String.format("%.1f", rec.getValue().getPercentageOfWind())));
    dataTable.getColumns().add(percentOfWindColumn);

    TableColumn<WindSlice, Speed> avgSpeedColumn = new TableColumn<>("Avg Speed");
    avgSpeedColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper<>(rec.getValue().getAvgSpeed()));
    dataTable.getColumns().add(avgSpeedColumn);

    TableColumn<WindSlice, Speed> maxSpeedColumn = new TableColumn<>("Max Speed");
    maxSpeedColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper<>(rec.getValue().getMaxSpeed()));
    dataTable.getColumns().add(maxSpeedColumn);

}

From source file:Main.java

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

    GridPane gridpane = createGridPane();
    FlowPane topBanner = createTopBanner();

    root.setTop(topBanner);//from w w w  .  ja va 2  s. c o  m
    root.setCenter(gridpane);

    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane bp = new BorderPane();
    bp.setPadding(new Insets(10, 20, 10, 20));

    Button btnTop = new Button("Top");
    bp.setTop(btnTop);//  www . j a v a 2 s  .c o m

    Button btnLeft = new Button("Left");
    bp.setLeft(btnLeft);

    Button btnCenter = new Button("Center");
    bp.setCenter(btnCenter);

    Button btnRight = new Button("Right");
    bp.setRight(btnRight);

    Button btnBottom = new Button("Bottom");
    bp.setBottom(btnBottom);

    Scene scene = new Scene(bp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("BorderPane Test");
    BorderPane bp = new BorderPane();
    bp.setPadding(new Insets(10, 20, 10, 20));

    Button btnTop = new Button("Top");
    bp.setTop(btnTop);/*from   ww w  .  ja  v a 2  s . c  o  m*/

    Button btnLeft = new Button("Left");
    bp.setLeft(btnLeft);

    Button btnCenter = new Button("Center");
    bp.setCenter(btnCenter);

    Button btnRight = new Button("Right");
    bp.setRight(btnRight);

    Button btnBottom = new Button("Bottom");
    bp.setBottom(btnBottom);

    Scene scene = new Scene(bp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane bp = new BorderPane();
    bp.setPadding(new Insets(10, 20, 10, 20));

    Button btnTop = new Button("Top");
    bp.setTop(btnTop);/*w  w w. java  2  s  . c  o  m*/

    Button btnLeft = new Button("Left");
    bp.setLeft(btnLeft);

    Button btnCenter = new Button("Center");
    bp.setCenter(btnCenter);

    Button btnRight = new Button("Right");
    bp.setRight(btnRight);

    Button btnBottom = new Button("Bottom");
    bp.setBottom(btnBottom);

    Scene scene = new Scene(bp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();

    System.out.println(bp.getTop());
    System.out.println(bp.getBottom());
    System.out.println(bp.getLeft());
    System.out.println(bp.getRight());
    System.out.println(bp.getCenter());
}