Example usage for javafx.scene.layout BorderPane setMargin

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

Introduction

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

Prototype

public static void setMargin(Node child, Insets value) 

Source Link

Document

Sets the margin for the child when contained by a border pane.

Usage

From source file:Main.java

public void start(Stage stage) {
    Node top = null;/*from ww w  . j  av  a2 s .  c  o  m*/
    Node left = null;

    VBox center = getCenter();

    Button okBtn = new Button("Ok");
    Button cancelBtn = new Button("Cancel");

    okBtn.setMaxWidth(Double.MAX_VALUE);
    VBox right = new VBox(okBtn, cancelBtn);
    right.setStyle("-fx-padding: 10;");

    Label statusLbl = new Label("Status: Ready");
    HBox bottom = new HBox(statusLbl);
    BorderPane.setMargin(bottom, new Insets(10, 0, 0, 0));

    BorderPane root = new BorderPane(center, top, right, bottom, left);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

public static Node createProgressIndicator() {
    ProgressIndicator indicator = new ProgressIndicator();
    indicator.setMaxHeight(350);/*from   w  w  w . j a v a2  s  .com*/
    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:Main.java

@Override
public void start(final Stage stage) {
    final Node loginPanel = makeDraggable(createLoginPanel());
    final Node confirmationPanel = makeDraggable(createConfirmationPanel());
    final Node progressPanel = makeDraggable(createProgressPanel());

    loginPanel.relocate(0, 0);//from   w ww  .  j  a v  a  2 s.  c  o  m
    confirmationPanel.relocate(0, 67);
    progressPanel.relocate(0, 106);

    final Pane panelsPane = new Pane();
    panelsPane.getChildren().addAll(loginPanel, confirmationPanel, progressPanel);

    final BorderPane sceneRoot = new BorderPane();

    BorderPane.setAlignment(panelsPane, Pos.TOP_LEFT);
    sceneRoot.setCenter(panelsPane);

    final CheckBox dragModeCheckbox = new CheckBox("Drag mode");
    BorderPane.setMargin(dragModeCheckbox, new Insets(6));
    sceneRoot.setBottom(dragModeCheckbox);

    dragModeActiveProperty.bind(dragModeCheckbox.selectedProperty());

    final Scene scene = new Scene(sceneRoot, 400, 300);
    stage.setScene(scene);
    stage.setTitle("Draggable Panels Example");
    stage.show();
}

From source file:com.cdd.bao.editor.EditSchema.java

public EditSchema(Stage stage) {
    this.stage = stage;

    if (MainApplication.icon != null)
        stage.getIcons().add(MainApplication.icon);

    menuBar = new MenuBar();
    menuBar.setUseSystemMenuBar(true);//from   w  w  w.  j a  v a2s.  c om
    menuBar.getMenus().add(menuFile = new Menu("_File"));
    menuBar.getMenus().add(menuEdit = new Menu("_Edit"));
    menuBar.getMenus().add(menuValue = new Menu("_Value"));
    menuBar.getMenus().add(menuView = new Menu("Vie_w"));
    createMenuItems();

    treeRoot = new TreeItem<>(new Branch(this));
    treeView = new TreeView<>(treeRoot);
    treeView.setEditable(true);
    treeView.setCellFactory(p -> new HierarchyTreeCell());
    treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldVal, newVal) -> {
        if (oldVal != null)
            pullDetail(oldVal);
        if (newVal != null)
            pushDetail(newVal);
    });
    treeView.focusedProperty()
            .addListener((val, oldValue, newValue) -> Platform.runLater(() -> maybeUpdateTree()));

    detail = new DetailPane(this);

    StackPane sp1 = new StackPane(), sp2 = new StackPane();
    sp1.getChildren().add(treeView);
    sp2.getChildren().add(detail);

    splitter = new SplitPane();
    splitter.setOrientation(Orientation.HORIZONTAL);
    splitter.getItems().addAll(sp1, sp2);
    splitter.setDividerPositions(0.4, 1.0);

    progBar = new ProgressBar();
    progBar.setMaxWidth(Double.MAX_VALUE);

    root = new BorderPane();
    root.setTop(menuBar);
    root.setCenter(splitter);
    root.setBottom(progBar);

    BorderPane.setMargin(progBar, new Insets(2, 2, 2, 2));

    Scene scene = new Scene(root, 1000, 800, Color.WHITE);

    stage.setScene(scene);

    treeView.setShowRoot(false);
    treeRoot.getChildren().add(treeTemplate = new TreeItem<>(new Branch(this, "Template")));
    treeRoot.getChildren().add(treeAssays = new TreeItem<>(new Branch(this, "Assays")));
    treeTemplate.setExpanded(true);
    treeAssays.setExpanded(true);

    rebuildTree();

    Platform.runLater(() -> treeView.getFocusModel().focus(treeView.getSelectionModel().getSelectedIndex())); // for some reason it defaults to not the first item

    stage.setOnCloseRequest(event -> {
        if (!confirmClose())
            event.consume();
    });

    updateTitle();

    // loading begins in a background thread, and is updated with a status bar
    Vocabulary.Listener listener = new Vocabulary.Listener() {
        public void vocabLoadingProgress(Vocabulary vocab, float progress) {
            Platform.runLater(() -> {
                progBar.setProgress(progress);
                if (vocab.isLoaded())
                    root.getChildren().remove(progBar);
            });
        }

        public void vocabLoadingException(Exception ex) {
            ex.printStackTrace();
        }
    };
    Vocabulary.globalInstance(listener);
}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    // Table Study
    initializeTable(tableStudy, StudyImpl.class);
    initializeTable(tablePlate, PlateImpl.class);
    initializeTable(tableSample, SampleImpl.class);
    initializeTable(tableInjection, InjectionImpl.class);
    initializeTable(tableCompound, CompoundImpl.class);
    initializeTable(tableHistory, OperationHistoryImpl.class);

    menuBar.setUseSystemMenuBar(true);/*from   w  ww.  j  ava 2s .com*/

    commandManager = new CommandManager();
    commandManager.setContext(commandManagerContext);
    final GUICommandPaneFactory commandPaneFactory = new GUICommandPaneFactory(commandManager);
    MetabolomeQC.addCorrectionCommands(commandManager);
    for (Map.Entry<String, Class> commend : commandManager.getCommands().entrySet()) {
        MenuItem menuItem = new MenuItem(commend.getKey());
        menuItem.setText(commend.getKey());
        menuItem.setOnAction(e -> {
            final Stage stage = new Stage();
            stage.initModality(Modality.WINDOW_MODAL);

            Parent guiCommand = commandPaneFactory.getCommandPane(commend.getKey(),
                    (commandEvent, managedCommand) -> {
                        stage.close();
                    });
            BorderPane margins = new BorderPane(guiCommand);
            BorderPane.setMargin(guiCommand, new Insets(10));

            stage.setScene(new Scene(margins));
            stage.initOwner(this.stage);
            stage.showAndWait();
            onRefresh(null);
        });
        correctionMenu.getItems().add(menuItem);
    }

    onRefresh(null);
}