Example usage for javafx.scene.control TitledPane TitledPane

List of usage examples for javafx.scene.control TitledPane TitledPane

Introduction

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

Prototype

public TitledPane(String title, Node content) 

Source Link

Document

Creates a new TitledPane with a title and content.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("TitledPane");
    Scene scene = new Scene(new Group(), 450, 250);
    scene.setFill(Color.GHOSTWHITE);

    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));

    TitledPane gridTitlePane = new TitledPane("Title", rootIcon);

    GridPane grid = new GridPane();
    grid.setVgap(4);/*from w w w .j a v a  2s  . co  m*/
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(new TextField(), 1, 0);
    grid.add(new Label("Cc: "), 0, 1);
    grid.add(new TextField(), 1, 1);
    grid.add(new Label("Subject: "), 0, 2);
    grid.add(new TextField(), 1, 2);
    grid.add(new Label("Attachment: "), 0, 3);
    grid.add(new Label("static value"), 1, 3);
    gridTitlePane.setText("Grid");
    gridTitlePane.setContent(grid);

    System.out.println(gridTitlePane.collapsibleProperty());

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(gridTitlePane);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java

@Override
protected BatchUpdateDialog createDialog() {

    ObservableList<UpdateFileNamesFromTagsItem> items = FXCollections.observableArrayList(
            this.getOtherFiles().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList()));
    StringProperty patternFieldProperty = new SimpleStringProperty();

    List<String> patternItems = Arrays.asList("${track} ${title}");
    ComboBox<String> patternBox = new ComboBox<>(FXCollections.observableArrayList(patternItems));
    patternBox.setEditable(true);/*from w  ww  .j  a v a2s.  co m*/
    patternBox.setMaxWidth(Double.MAX_VALUE);
    Bindings.bindBidirectional(patternFieldProperty, patternBox.editorProperty().get().textProperty());
    HBox.setHgrow(patternBox, Priority.ALWAYS);

    Button executeButton = new Button(this.getLocalization().executeRename(),
            new ImageView(new Image(UpdateFileNamesFromTagsActionEventHandler.class.getClassLoader()
                    .getResourceAsStream("icons/16/save.png"))));
    executeButton.setDisable(true);
    patternFieldProperty
            .addListener((o, oldValue, newValue) -> executeButton.setDisable(newValue.length() <= 0));

    HBox patternFieldPane = new HBox(10, patternBox, executeButton);
    patternFieldPane.setPadding(new Insets(5, 5, 5, 5));

    TitledPane patternFieldTitlePane = new TitledPane(this.getLocalization().fileNamePattern(),
            patternFieldPane);
    patternFieldTitlePane.setCollapsible(false);

    TableView<?> newFileNamesPane = this.createNewFileNamesPane(items);
    newFileNamesPane.setPrefHeight(400);
    VBox.setVgrow(newFileNamesPane, Priority.ALWAYS);

    VBox actionPane = new VBox(10, patternFieldTitlePane, newFileNamesPane);

    // Create the dialog and finish
    BatchUpdateDialog dialog = new BatchUpdateDialog();
    dialog.setDialogPrefWidth(800);
    dialog.setDialogTitle(this.getLocalization().updateFileNames());
    dialog.setActionPane(actionPane);
    dialog.setLegendPane(this.createLegendPane());

    // Add listeners
    this.getOtherFiles().addListener(
            new WeakListChangeListener<>((Change<? extends TaggableFile> change) -> items.setAll(change
                    .getList().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList()))));
    patternFieldProperty.addListener((o, oldValue, newValue) -> this.computeNewFileNames(items, newValue));
    executeButton.setOnAction(event -> {
        this.updateNewFileNames(items);
        ((Stage) executeButton.getScene().getWindow()).close();
    });

    return dialog;

}

From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java

private Parent createLegendPane() {

    GridPane legendPane = new GridPane();
    legendPane.setPadding(new Insets(5, 5, 5, 5));
    int columnCount = 3;
    int currentRow = 0;
    int currentColumn = 0;
    for (UpdateFileNamesPlaceholder placeholder : UpdateFileNamesPlaceholder.values()) {

        StringBuilder placeholderText = new StringBuilder();
        placeholderText.append("${").append(placeholder.getPlaceholder()).append("}: ");
        placeholderText.append(placeholder.resolveLocalization(this.getLocalization()));

        Label placeholderLabel = new Label(placeholderText.toString());
        placeholderLabel.setMaxWidth(Double.MAX_VALUE);
        placeholderLabel.setPadding(new Insets(3, 3, 3, 3));
        placeholderLabel.setAlignment(Pos.TOP_LEFT);
        legendPane.add(placeholderLabel, currentColumn, currentRow);
        GridPane.setFillWidth(placeholderLabel, Boolean.TRUE);
        GridPane.setHgrow(placeholderLabel, Priority.ALWAYS);

        currentColumn++;/*from ww  w  .ja v  a2 s  .  co m*/
        if (currentColumn >= columnCount) {
            currentRow++;
            currentColumn = 0;
        }

    }

    TitledPane legendTitlePane = new TitledPane(this.getLocalization().legend(), legendPane);
    legendTitlePane.setCollapsible(false);
    return legendTitlePane;

}

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

private void createDialogItems() {
    Validate.notNull(this.logReader); // Will be used to initialize input field values

    // CHECKSTYLE:OFF Yes, we are using lots of constants here. It does not make sense to name them using final variables.
    final GridPane gp = new GridPane();
    gp.setAlignment(Pos.BASELINE_LEFT);//from   w  w  w  . j  a  va 2 s . c o  m
    gp.setHgap(10d);
    gp.setVgap(15d);
    gp.setPadding(new Insets(5d));
    final ColumnConstraints column1 = new ColumnConstraints();
    final ColumnConstraints column2 = new ColumnConstraints();
    column1.setHgrow(Priority.NEVER);
    column2.setHgrow(Priority.SOMETIMES);
    gp.getColumnConstraints().addAll(column1, column2);
    this.insertConfigItemsIntoGrid(gp, this.createConfigurationForm());
    final TitledPane configPane = new TitledPane("Edit Configuration", gp);
    configPane.setGraphic(Icons.getIconGraphics("pencil"));
    configPane.setCollapsible(false);

    final VBox lines = this.createRunForm();
    final TitledPane testPane = new TitledPane("Test Configuration", lines);
    testPane.setGraphic(Icons.getIconGraphics("script_go"));
    testPane.setCollapsible(false);

    final VBox panes = new VBox(configPane, testPane);
    panes.setSpacing(10d);
    final ScrollPane sp = new ScrollPane(panes);
    sp.setPadding(new Insets(10d));
    sp.setFitToWidth(true);
    this.setCenter(sp);
    // CHECKSTYLE:ON
}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRow1(final Pane content, final BookingBean be) {
    final VBox box = new VBox();
    final HBox box0 = new HBox();
    final HBox box1 = new HBox();
    final HBox box2 = new HBox();
    box.setFillWidth(true);/*from   w  ww . j  av a2  s .c  o m*/
    box0.setFillHeight(true);
    box1.setFillHeight(true);
    box2.setFillHeight(true);
    addCheckInNote(box0, be);
    addCheckOutNote(box1, be);
    addSpecialRequestNote(box2, be);
    box.getChildren().addAll(box0, box1, box2);
    final TitledPane pane = new TitledPane("Notes", box);
    pane.setExpanded(false);
    content.getChildren().add(pane);

}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

public TitledPane createPanelForConfiguration() {
    final GridPane gp = new GridPane();
    gp.setAlignment(Pos.BASELINE_LEFT);//from  w w  w  .  j a v a 2  s.  c o m
    final double hGapOfGridPane = 10d;
    gp.setHgap(hGapOfGridPane);
    final double vGapOfGridPane = 15d;
    gp.setVgap(vGapOfGridPane);
    final double paddingOfGridPane = 5d;
    gp.setPadding(new Insets(paddingOfGridPane));
    final ColumnConstraints column1 = new ColumnConstraints();
    final ColumnConstraints column2 = new ColumnConstraints();
    column1.setHgrow(Priority.NEVER);
    column2.setHgrow(Priority.SOMETIMES);
    gp.getColumnConstraints().addAll(column1, column2);
    this.insertConfigItemsIntoGrid(gp, this.createConfigurationForm());
    final TitledPane configPane = new TitledPane("Edit Configuration", gp);
    configPane.setGraphic(Icons.getIconGraphics("pencil"));
    configPane.setCollapsible(false);
    return configPane;
}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

public TitledPane createPanelForLaunchingTests() {
    final Button startBtn = new Button("Run Test");
    startBtn.disableProperty().bind(this.testRunService.runningProperty());
    final double startButtonPadding = 8d;
    startBtn.setPadding(new Insets(startButtonPadding));
    startBtn.setGraphic(Icons.getIconGraphics("control_play_blue"));
    HBox.setHgrow(startBtn, Priority.ALWAYS);
    startBtn.setMaxWidth(Double.MAX_VALUE);
    startBtn.setOnAction(event -> {/*from   w w w .ja  va 2 s  .  c  o  m*/
        final Job job = this.createJobFromConfig();
        this.testRunService.setJob(job);
        this.testRunService.start();
    });
    final HBox startLine = new HBox();
    startLine.getChildren().add(startBtn);
    final VBox runLines = new VBox();
    final double linesSpacing = 10d;
    runLines.setSpacing(linesSpacing);
    final TextFlow resultBar = new TextFlow();
    resultBar.backgroundProperty().bind(this.resultBarBackgroundProperty);
    this.resultBarBackgroundProperty.set(RESULT_BAR_BACKGROUND_IDLE);
    resultBar.setStyle("-fx-border-color: black; -fx-border-width:1");
    final Text resultBarText = new Text();
    resultBarText.textProperty().bind(this.resultBarTextProperty);
    this.resultBarTextProperty.set("Idle");
    resultBar.getChildren().add(resultBarText);
    resultBar.setTextAlignment(TextAlignment.CENTER);
    final double resultBarPadding = 2d;
    resultBar.setPadding(new Insets(resultBarPadding));
    final int logOutputLinesSize = 25;
    this.resultLogOutputText.setPrefRowCount(logOutputLinesSize);
    this.resultLogOutputText.setEditable(false);
    this.resultLogOutputText.setStyle("-fx-font-family: monospace");
    HBox.setHgrow(this.resultLogOutputText, Priority.ALWAYS);
    runLines.getChildren().addAll(startLine, new Text("Recent results:"), resultBar, this.resultLogOutputText);
    final TitledPane runPane = new TitledPane("Run", runLines);
    runPane.setGraphic(Icons.getIconGraphics("lightning_go"));
    runPane.setCollapsible(false);
    return runPane;
}

From source file:Main.java

private VBox getTransformationControls() {
    xSlider.setShowTickMarks(true);//from w  w w  .  ja  v a2  s .c  o m
    xSlider.setShowTickLabels(true);
    xSlider.snapToTicksProperty().set(true);

    ySlider.setShowTickMarks(true);
    ySlider.setShowTickLabels(true);
    ySlider.snapToTicksProperty().set(true);

    widthSlider.setShowTickMarks(true);
    widthSlider.setShowTickLabels(true);
    widthSlider.snapToTicksProperty().set(true);

    heightSlider.setShowTickMarks(true);
    heightSlider.setShowTickLabels(true);
    heightSlider.snapToTicksProperty().set(true);

    opacitySlider.setShowTickMarks(true);
    opacitySlider.setShowTickLabels(true);
    opacitySlider.snapToTicksProperty().set(true);
    opacitySlider.setMinorTickCount(5);
    opacitySlider.setMajorTickUnit(0.20d);

    strokeSlider.setShowTickMarks(true);
    strokeSlider.setShowTickLabels(true);
    strokeSlider.snapToTicksProperty().set(true);
    strokeSlider.setMinorTickCount(5);
    strokeSlider.setMajorTickUnit(1.0d);

    translateXSlider.setShowTickMarks(true);
    translateXSlider.setShowTickLabels(true);
    translateXSlider.snapToTicksProperty().set(true);

    translateYSlider.setShowTickMarks(true);
    translateYSlider.setShowTickLabels(true);
    translateYSlider.snapToTicksProperty().set(true);

    rotateSlider.setShowTickMarks(true);
    rotateSlider.setShowTickLabels(true);
    rotateSlider.snapToTicksProperty().set(true);
    rotateSlider.setMinorTickCount(5);
    rotateSlider.setMajorTickUnit(30.0);

    scaleXSlider.setShowTickMarks(true);
    scaleXSlider.setShowTickLabels(true);
    scaleXSlider.setMajorTickUnit(0.2d);
    scaleXSlider.setLabelFormatter(new DoubleStringConverter());
    scaleXSlider.snapToTicksProperty().set(true);

    scaleYSlider.setShowTickMarks(true);
    scaleYSlider.setShowTickLabels(true);
    scaleYSlider.setMajorTickUnit(0.2d);
    scaleYSlider.setLabelFormatter(new DoubleStringConverter());
    scaleYSlider.snapToTicksProperty().set(true);

    shearXSlider.setShowTickMarks(true);
    shearXSlider.setShowTickLabels(true);
    shearXSlider.setMajorTickUnit(0.2d);
    shearXSlider.setLabelFormatter(new DoubleStringConverter());
    shearXSlider.snapToTicksProperty().set(true);

    shearYSlider.setShowTickMarks(true);
    shearYSlider.setShowTickLabels(true);
    shearYSlider.setMajorTickUnit(0.2d);
    shearYSlider.setLabelFormatter(new DoubleStringConverter());
    shearYSlider.snapToTicksProperty().set(true);

    HBox xyBox = new HBox();
    xyBox.setSpacing(5);
    xyBox.getChildren().addAll(VBoxBuilder.create().children(xLabel, xSlider).build(),
            VBoxBuilder.create().children(yLabel, ySlider).build());

    HBox whBox = new HBox();
    whBox.setSpacing(5);
    whBox.getChildren().addAll(VBoxBuilder.create().children(widthLabel, widthSlider).build(),
            VBoxBuilder.create().children(heightLabel, heightSlider).build());

    HBox colorBox = new HBox();
    colorBox.setSpacing(5);
    colorBox.getChildren().addAll(VBoxBuilder.create().children(strokeLabel, strokeSlider).build(),
            VBoxBuilder.create().children(new Label("Stroke Color"), rectStrokeColorChoiceBox).build());

    HBox opacityBox = new HBox();
    opacityBox.setSpacing(5);
    opacityBox.getChildren().addAll(VBoxBuilder.create().children(opacityLabel, opacitySlider).build(),
            VBoxBuilder.create().children(new Label("Fill Color"), rectFillColorChoiceBox).build());

    HBox translateBox = new HBox();
    translateBox.setSpacing(5);
    translateBox.getChildren().addAll(VBoxBuilder.create().children(translateXLabel, translateXSlider).build(),
            VBoxBuilder.create().children(translateYLabel, translateYSlider).build());

    HBox rotateBox = new HBox();
    rotateBox.setSpacing(5);
    rotateBox.getChildren().addAll(VBoxBuilder.create().children(rotateLabel, rotateSlider).build());

    HBox scaleBox = new HBox();
    scaleBox.setSpacing(5);
    scaleBox.getChildren().addAll(VBoxBuilder.create().children(scaleXLabel, scaleXSlider).build(),
            VBoxBuilder.create().children(scaleYLabel, scaleYSlider).build());

    HBox shearBox = new HBox();
    shearBox.setSpacing(5);
    shearBox.getChildren().addAll(VBoxBuilder.create().children(shearXLabel, shearXSlider).build(),
            VBoxBuilder.create().children(shearYLabel, shearYSlider).build());

    VBox rectangleBox = new VBox();
    rectangleBox.getChildren().addAll(xyBox, whBox, colorBox, opacityBox);
    TitledPane rectangleProps = new TitledPane("Rectangle", rectangleBox);

    VBox transformBox = new VBox();
    transformBox.getChildren().addAll(translateBox, rotateBox, scaleBox, shearBox);
    TitledPane transformsProps = new TitledPane("Tranformations", transformBox);

    TitledPane showBoundsControls = getShowBoundsControls();
    TitledPane effectPane = getEffectTitledPane();

    Button resetAllButton = new Button("Reset All");
    resetAllButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            resetAll();
        }
    });

    Button saveButton = new Button("Save Layout as Image");
    saveButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            saveLayoutAsImage();
        }
    });

    Button exitButton = new Button("Exit");
    exitButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            Platform.exit();
        }
    });

    /*
    Button printButton = new Button("Print");
    printButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            String str = getDesc("layoutBounds", mainRect.getLayoutBounds()) +
                         getDesc("\nboundsInLocal", mainRect.getBoundsInLocal()) +
                         getDesc("\nboundsInParent", mainRect.getBoundsInParent());
                    
            //printDataTextArea.setText(str);
        }
                
        private String getDesc(String type, Bounds b) {
            String str = type + "[minX=" + b.getMinX() +
                         ", minY=" + b.getMinY() +
                         ", width=" + b.getWidth() +
                         ", height=" + b.getHeight() + "]";
            return str;
        }
    });
    */

    HBox buttonBox = new HBox();
    buttonBox.setSpacing(10);
    buttonBox.getChildren().addAll(resetAllButton, saveButton, exitButton);

    VBox vBox = new VBox();
    vBox.getChildren().addAll(buttonBox, showBoundsControls, rectangleProps, effectPane, transformsProps);
    return vBox;
}

From source file:Main.java

private TitledPane getShowBoundsControls() {
    ChangeListener<Boolean> cl = new ChangeListener<Boolean>() {
        @Override/* w  ww  .  j av a  2  s .  c om*/
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue,
                Boolean newValue) {
            relayout();
        }
    };

    ChangeListener<Boolean> cl2 = new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue,
                Boolean newValue) {
            animate();
        }
    };

    layoutCbx.selectedProperty().addListener(cl);
    localCbx.selectedProperty().addListener(cl);
    parentCbx.selectedProperty().addListener(cl);
    effectGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) {
            relayout();
        }
    });

    layoutAnimateCbx.selectedProperty().addListener(cl2);
    localAnimateCbx.selectedProperty().addListener(cl2);
    parentAnimateCbx.selectedProperty().addListener(cl2);

    double w = 20.0;
    double h = 10.0;

    Rectangle rLayout = new Rectangle(w, h);
    rLayout.setFill(LAYOUT_BOUNDS_RECT_FILL_COLOR);
    rLayout.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rLayout.setStroke(LAYOUT_BOUNDS_RECT_STROKE_COLOR);

    Rectangle rLocal = new Rectangle(w, h);
    rLocal.setFill(LOCAL_BOUNDS_RECT_FILL_COLOR);
    rLocal.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rLocal.setStroke(LOCAL_BOUNDS_RECT_STROKE_COLOR);

    Rectangle rParent = new Rectangle(w, h);
    rParent.setFill(PARENT_BOUNDS_RECT_FILL_COLOR);
    rParent.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rParent.setStroke(PARENT_BOUNDS_RECT_STROKE_COLOR);

    GridPane gp = new GridPane();
    gp.addRow(1, rLayout, new Text("Layout Bounds:"), layoutCbx, layoutAnimateCbx);
    gp.addRow(2, rLocal, new Text("Local Bounds:"), localCbx, localAnimateCbx);
    gp.addRow(3, rParent, new Text("Parent Bounds:"), parentCbx, parentAnimateCbx);

    TitledPane titledPane = new TitledPane("Show Bounds", gp);

    return titledPane;
}

From source file:Main.java

private TitledPane getEffectTitledPane() {
    noneEffect.setToggleGroup(effectGroup);
    noneEffect.setSelected(true);//from   w w w.jav a  2  s .  c om

    dropshadowEffect.setToggleGroup(effectGroup);
    reflectionEffect.setToggleGroup(effectGroup);
    glowEffect.setToggleGroup(effectGroup);

    HBox hBox = new HBox();
    hBox.setPadding(new Insets(5, 5, 5, 5));
    hBox.getChildren().addAll(noneEffect, dropshadowEffect, reflectionEffect, glowEffect);

    TitledPane effectsPane = new TitledPane("Effect", hBox);

    return effectsPane;
}