Example usage for javafx.scene.layout BorderPane setPadding

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

Introduction

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

Prototype

public final void setPadding(Insets value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {

    BorderPane bp = new BorderPane();
    bp.setPadding(new Insets(10, 50, 50, 50));
    Scene scene = new Scene(bp);
    primaryStage.setScene(scene);/*from  ww  w. j  a  v  a  2  s.c  om*/
    primaryStage.titleProperty()
            .bind(scene.widthProperty().asString().concat(" : ").concat(scene.heightProperty().asString()));

    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);/*from ww  w .j av a2 s  .co  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 w  ww  . j  a  v a 2s  .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 .j  a  v a2s .  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());
}

From source file:com.core.meka.SOMController.java

private void initPopovers() {
    patronesEntrenamientoPopover = new PopOver();

    StackPane pane = new StackPane();
    BorderPane b = new BorderPane();
    b.setPadding(new Insets(10, 20, 10, 20));
    VBox vbox = new VBox();
    Label title = new Label("Configuracion correcta");
    Label content = new Label("Aqui un ejemplo de configuracion");
    Label content1 = new Label("de patrones de entrenamiento de dimension 2");
    content.setPadding(new Insets(5, 0, 0, 0));
    content1.setPadding(new Insets(5, 0, 0, 0));
    content.setWrapText(true);//from   ww  w  .  j  a  v  a 2  s . c om
    vbox.getChildren().addAll(title, content, content1, new ImageView(new Image("/img/config1.png")));
    b.setCenter(vbox);

    patronesEntrenamientoPopover.setContentNode(b);
}

From source file:qupath.lib.gui.panels.classify.RandomTrainingRegionSelector.java

private void createDialog() {
    dialog = new Stage();
    dialog.initOwner(qupath.getStage());
    dialog.setTitle("Training sample selector");

    pointCreator = new RandomPointCreator();

    for (PathClass pathClass : pathClassListModel) {
        if (pathClass != null && pathClass.getName() != null)
            pointCreator.addPathClass(pathClass,
                    KeyCode.getKeyCode(pathClass.getName().toUpperCase().substring(0, 1)));
        //            pointCreator.addPathClass(pathClass, KeyStroke.getKeyStroke(new pathClass.getName().toLowerCase().charAt(0), 0).getKeyCode());
    }/*ww  w.  j  a va2 s  .c  o  m*/
    //      PathClass tumourClass = PathClassFactory.getDefaultPathClass(PathClasses.TUMOR);
    //      PathClass stromaClass = PathClassFactory.getDefaultPathClass(PathClasses.STROMA);
    //      pointCreator.addPathClass(tumourClass, KeyCode.T);
    //      pointCreator.addPathClass(stromaClass, KeyCode.S);
    QuPathViewer viewer = qupath.getViewer();
    pointCreator.registerViewer(viewer);

    // Adapt to changing active viewers
    ImageDataChangeListener<BufferedImage> listener = new ImageDataChangeListener<BufferedImage>() {

        @Override
        public void imageDataChanged(ImageDataWrapper<BufferedImage> source,
                ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew) {
            if (pointCreator != null) {
                QuPathViewer viewer = qupath.getViewer();
                pointCreator.registerViewer(viewer);
                updateObjectCache(viewer);
            }
            refreshList();
            updateLabel();
        }

    };
    qupath.addImageDataChangeListener(listener);

    // Remove listeners for cleanup
    dialog.setOnCloseRequest(e -> {
        pointCreator.deregisterViewer();
        qupath.removeImageDataChangeListener(listener);
        dialog.setOnCloseRequest(null);
        dialog = null;
        // Re-enable mode switching
        qupath.setModeSwitchingEnabled(true);
    });

    ParameterPanelFX paramPanel = new ParameterPanelFX(params);
    paramPanel.getPane().setPadding(new Insets(2, 5, 5, 5));

    list = new ListView<PathClass>(pathClassListModel);
    list.setPrefSize(400, 200);

    // TODO: ADD A SENSIBLE RENDERER!
    // For now, this is simply duplicated from PathAnnotationPanel
    list.setCellFactory(new Callback<ListView<PathClass>, ListCell<PathClass>>() {

        @Override
        public ListCell<PathClass> call(ListView<PathClass> p) {

            ListCell<PathClass> cell = new ListCell<PathClass>() {

                @Override
                protected void updateItem(PathClass value, boolean bln) {
                    super.updateItem(value, bln);
                    int size = 10;
                    if (value == null) {
                        setText(null);
                        setGraphic(null);
                    } else if (value.getName() == null) {
                        setText("None");
                        setGraphic(new Rectangle(size, size, ColorToolsFX.getCachedColor(0, 0, 0, 0)));
                    } else {
                        setText(value.getName());
                        setGraphic(new Rectangle(size, size, ColorToolsFX.getPathClassColor(value)));
                    }
                }

            };

            return cell;
        }
    });

    //      list.setCellRenderer(new PathClassListCellRendererPoints());

    list.setTooltip(new Tooltip("Available classes"));

    labelCount = new Label();
    labelCount.setTextAlignment(TextAlignment.CENTER);
    labelCount.setPadding(new Insets(5, 0, 5, 0));
    BorderPane panelTop = new BorderPane();
    panelTop.setTop(paramPanel.getPane());
    panelTop.setCenter(list);
    panelTop.setBottom(labelCount);
    labelCount.prefWidthProperty().bind(panelTop.widthProperty());
    updateLabel();

    //      panelButtons.add(new JButton(new UndoAction("Undo")));
    Action actionAdd = new Action("Add to class", e -> {
        if (list == null || pointCreator == null)
            return;
        PathClass pathClass = list.getSelectionModel().getSelectedItem();
        pointCreator.addPoint(pathClass);
    });
    Action actionSkip = new Action("Skip", e -> {
        if (pointCreator != null)
            pointCreator.addPoint(null);
    });

    GridPane panelButtons = PanelToolsFX.createColumnGridControls(ActionUtils.createButton(actionAdd),
            ActionUtils.createButton(actionSkip));

    BorderPane pane = new BorderPane();
    pane.setCenter(panelTop);
    pane.setBottom(panelButtons);

    pane.setPadding(new Insets(10, 10, 10, 10));
    Scene scene = new Scene(pane);
    dialog.setScene(scene);
}

From source file:qupath.lib.gui.tma.TMASummaryViewer.java

private Pane createSidePane() {
    BorderPane pane = new BorderPane();

    TabPane tabPane = new TabPane();

    kmDisplay = new KaplanMeierDisplay(null, null, null, null);
    BorderPane paneKaplanMeier = new BorderPane();
    paneKaplanMeier.setCenter(kmDisplay.getView());
    paneKaplanMeier.setPadding(new Insets(10, 10, 10, 10));
    //      comboMainMeasurement.prefWidthProperty().bind(paneKaplanMeier.widthProperty());
    comboMainMeasurement.setMaxWidth(Double.MAX_VALUE);
    comboMainMeasurement.setTooltip(new Tooltip("Measurement thresholded to create survival curves etc."));

    GridPane kmTop = new GridPane();
    kmTop.add(new Label("Score"), 0, 0);
    kmTop.add(comboMainMeasurement, 1, 0);
    kmTop.add(new Label("Survival type"), 0, 1);
    kmTop.add(comboSurvival, 1, 1);//w w w.j a va 2  s .  c  om
    comboSurvival.setTooltip(new Tooltip("Specify overall or recurrence-free survival (if applicable)"));
    comboSurvival.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(comboMainMeasurement, Priority.ALWAYS);
    GridPane.setHgrow(comboSurvival, Priority.ALWAYS);
    kmTop.setHgap(5);
    paneKaplanMeier.setTop(kmTop);
    //      kmDisplay.setOrientation(Orientation.VERTICAL);

    histogramDisplay = new HistogramDisplay(model, false);

    comboMainMeasurement.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        histogramDisplay.refreshCombo();
        histogramDisplay.showHistogram(n);
        updateSurvivalCurves();
    });
    comboMeasurementMethod.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        histogramDisplay.refreshHistogram();
        scatterPane.updateChart();
        updateSurvivalCurves();
    });
    comboSurvival.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        updateSurvivalCurves();
    });

    // Create a Tab for showing images
    BorderPane paneImages = new BorderPane();
    CheckBox cbShowOverlay = new CheckBox("Show overlay");
    imageAvailability.addListener((c, v, n) -> {
        if (n == ImageAvailability.OVERLAY_ONLY)
            cbShowOverlay.setSelected(true);
        else if (n == ImageAvailability.IMAGE_ONLY)
            cbShowOverlay.setSelected(false);
        cbShowOverlay.setDisable(n != ImageAvailability.BOTH);
    });
    ListView<TMAEntry> listImages = new ListView<>();
    listImages.setCellFactory(v -> new ImageListCell(cbShowOverlay.selectedProperty(), imageCache));
    listImages.widthProperty().addListener((v, o, n) -> listImages.refresh());
    listImages.setStyle("-fx-control-inner-background-alt: -fx-control-inner-background ;");
    table.getSelectionModel().getSelectedItems().addListener((Change<? extends TreeItem<TMAEntry>> e) -> {
        List<TMAEntry> entries = new ArrayList<>();
        for (TreeItem<TMAEntry> item : e.getList()) {
            if (item.getChildren().isEmpty()) {
                if (item.getValue().hasImage() || item.getValue().hasOverlay())
                    entries.add(item.getValue());
            } else {
                for (TreeItem<TMAEntry> item2 : item.getChildren()) {
                    if (item2.getValue().hasImage() || item2.getValue().hasOverlay())
                        entries.add(item2.getValue());
                }
            }
            listImages.getItems().setAll(entries);
        }
    });
    cbShowOverlay.setAlignment(Pos.CENTER);
    cbShowOverlay.setMaxWidth(Double.MAX_VALUE);
    cbShowOverlay.setPadding(new Insets(5, 5, 5, 5));
    cbShowOverlay.selectedProperty().addListener((v, o, n) -> listImages.refresh());
    paneImages.setCenter(listImages);
    paneImages.setTop(cbShowOverlay);

    // Determine visibility based upon whether there are any images to show
    //      Tab tabImages = new Tab("Images", paneImages);

    ScrollPane scrollPane = new ScrollPane(paneKaplanMeier);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    Tab tabSurvival = new Tab("Survival", scrollPane);
    tabPane.getTabs().addAll(new Tab("Table", getCustomizeTablePane()),
            //            tabImages,
            new Tab("Histogram", histogramDisplay.getPane()), new Tab("Scatterplot", scatterPane.getPane()),
            tabSurvival);
    tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);

    //      if (imageAvailability.get() != ImageAvailability.NONE)
    //         tabPane.getTabs().add(1, tabImages);
    //      
    //      imageAvailability.addListener((c, v, n) -> {
    //         if (n == ImageAvailability.NONE)
    //            tabPane.getTabs().remove(tabImages);
    //         else if (!tabPane.getTabs().contains(tabImages))
    //            tabPane.getTabs().add(1, tabImages);
    //      });

    //      tabSurvival.visibleProperty().bind(
    //            Bindings.createBooleanBinding(() -> !survivalColumns.isEmpty(), survivalColumns)
    //            );

    pane.setCenter(tabPane);

    pane.setMinWidth(350);

    return pane;
}