Example usage for javafx.scene.control CheckBox setPadding

List of usage examples for javafx.scene.control CheckBox setPadding

Introduction

In this page you can find the example usage for javafx.scene.control CheckBox setPadding.

Prototype

public final void setPadding(Insets value) 

Source Link

Usage

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param lstPano/*  w  w w  . ja va 2 s. c om*/
 * @param numPano
 * @return
 */
public Pane affichageHS(String lstPano, int numPano) {

    Pane panneauHotSpots = new Pane();
    panneauHotSpots.setTranslateY(10);
    panneauHotSpots.setTranslateX(30);
    VBox vb1 = new VBox(5);
    panneauHotSpots.getChildren().add(vb1);
    Label lblPoint;
    Label sep = new Label(" ");
    Label sep1 = new Label(" ");
    int o;
    for (o = 0; o < panoramiquesProjet[numPano].getNombreHotspots(); o++) {
        VBox vbPanneauHS = new VBox();
        double deplacement = 20;
        vbPanneauHS.setLayoutX(deplacement);
        Pane pannneauHS = new Pane(vbPanneauHS);
        pannneauHS.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3;");
        panneauHotSpots.setId("HS" + o);
        lblPoint = new Label("Point n" + (o + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setTranslateX(-deplacement);
        lblPoint.setStyle("-fx-background-color : #333;");
        lblPoint.setTextFill(Color.WHITE);
        Separator sp = new Separator(Orientation.HORIZONTAL);
        sp.setTranslateX(-deplacement);
        sp.setPrefWidth(300);

        pannneauHS.setPrefWidth(300);
        pannneauHS.setTranslateX(5);
        vbPanneauHS.getChildren().addAll(lblPoint, sp);
        if (lstPano != null) {
            Label lblLien = new Label("Panoramique de destination");
            ComboBox cbDestPano = new ComboBox();
            String[] liste = lstPano.split(";");
            cbDestPano.getItems().addAll(Arrays.asList(liste));
            cbDestPano.valueProperty().addListener(new ChangeListener<String>() {
                @Override
                public void changed(ObservableValue ov, String t, String t1) {
                    valideHS();
                }
            });
            cbDestPano.setTranslateX(60);
            cbDestPano.setId("cbpano" + o);

            String f1XML = panoramiquesProjet[numPano].getHotspot(o).getFichierXML();
            if (f1XML != null) {
                cbDestPano.setValue(f1XML.split("\\.")[0]);
            }
            int num = cbDestPano.getSelectionModel().getSelectedIndex();
            vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, sep);
        }
        Label lblTexteHS = new Label("Texte du Hotspot");
        TextArea txtTexteHS = new TextArea();
        if (panoramiquesProjet[numPano].getHotspot(o).getInfo() != null) {
            txtTexteHS.setText(panoramiquesProjet[numPano].getHotspot(o).getInfo());
        }
        txtTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        txtTexteHS.setId("txtHS" + o);
        txtTexteHS.setPrefSize(200, 25);
        txtTexteHS.setMaxSize(200, 20);
        txtTexteHS.setTranslateX(60);
        CheckBox cbAnime = new CheckBox("HostSpot Anim");
        cbAnime.setId("anime" + o);
        cbAnime.selectedProperty().addListener((final ObservableValue<? extends Boolean> observable,
                final Boolean oldValue, final Boolean newValue) -> {
            valideHS();
        });
        if (panoramiquesProjet[numPano].getHotspot(o).isAnime()) {
            cbAnime.setSelected(true);
        }
        cbAnime.setPadding(new Insets(5));
        cbAnime.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, txtTexteHS, cbAnime, sep1);
        vb1.getChildren().addAll(pannneauHS, sep);
    }
    int nbHS = o;
    for (o = 0; o < panoramiquesProjet[numPano].getNombreHotspotImage(); o++) {
        VBox vbPanneauHS = new VBox();
        Pane pannneauHS = new Pane(vbPanneauHS);
        pannneauHS.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3;");
        panneauHotSpots.setId("HSImg" + o);
        lblPoint = new Label("Image n" + (o + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setStyle("-fx-background-color : #666;");
        lblPoint.setTextFill(Color.WHITE);
        Separator sp = new Separator(Orientation.HORIZONTAL);
        sp.setPrefWidth(300);

        pannneauHS.setPrefWidth(300);
        pannneauHS.setTranslateX(5);
        vbPanneauHS.getChildren().addAll(lblPoint, sp);
        Label lblLien = new Label("Image choisie :");
        String f1XML = panoramiquesProjet[numPano].getHotspotImage(o).getLienImg();
        ImageView IMChoisie = new ImageView(
                new Image("file:" + repertTemp + File.separator + "images" + File.separator + f1XML, 100, -1,
                        true, true));
        IMChoisie.setTranslateX(100);
        vbPanneauHS.getChildren().addAll(lblLien, IMChoisie, sep);
        Label lblTexteHS = new Label("Texte du Hotspot");
        TextArea txtTexteHS = new TextArea();
        if (panoramiquesProjet[numPano].getHotspotImage(o).getInfo() != null) {
            txtTexteHS.setText(panoramiquesProjet[numPano].getHotspotImage(o).getInfo());
        }
        txtTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        txtTexteHS.setId("txtHSImage" + o);
        txtTexteHS.setPrefSize(200, 25);
        txtTexteHS.setMaxSize(200, 20);
        txtTexteHS.setTranslateX(60);
        CheckBox cbAnime = new CheckBox("HostSpot Anim");
        cbAnime.setId("animeImage" + o);
        cbAnime.selectedProperty().addListener((final ObservableValue<? extends Boolean> observable,
                final Boolean oldValue, final Boolean newValue) -> {
            valideHS();
        });
        if (panoramiquesProjet[numPano].getHotspotImage(o).isAnime()) {
            cbAnime.setSelected(true);
        }
        cbAnime.setPadding(new Insets(5));
        cbAnime.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, txtTexteHS, cbAnime, sep1);
        vb1.getChildren().addAll(pannneauHS, sep);
    }
    valideHS();
    nbHS += o;
    //        if (nbHS == 0) {
    //        } else {
    //            btnValider.setVisible(true);
    //        }
    return panneauHotSpots;
}

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 .  ja  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;
}