Example usage for javafx.scene.control Accordion getExpandedPane

List of usage examples for javafx.scene.control Accordion getExpandedPane

Introduction

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

Prototype

public final TitledPane getExpandedPane() 

Source Link

Document

Gets the expanded TitledPane in the Accordion.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");

    Group g = new Group();
    Scene scene = new Scene(g, 550, 250, Color.web("0x0000FF", 1.0));

    TitledPane t1 = new TitledPane("T1", new Button("B1"));
    TitledPane t2 = new TitledPane("T2", new Button("B2"));
    TitledPane t3 = new TitledPane("T3", new Button("B3"));
    Accordion accordion = new Accordion();
    accordion.getPanes().addAll(t1, t2, t3);

    TitledPane titledPane = accordion.getExpandedPane();

    g.getChildren().add(accordion);//from ww w. j a  v a2 s.  co m

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group g = new Group();
    Scene scene = new Scene(g, 550, 250);

    TitledPane t1 = new TitledPane("T1", new Button("B1"));
    TitledPane t2 = new TitledPane("T2", new Button("B2"));
    TitledPane t3 = new TitledPane("T3", new Button("B3"));
    Accordion accordion = new Accordion();
    accordion.getPanes().addAll(t1, t2, t3);

    accordion.expandedPaneProperty()//from  www  . ja  v  a 2s .  c  o  m
            .addListener((ObservableValue<? extends TitledPane> ov, TitledPane old_val, TitledPane new_val) -> {
                if (new_val != null) {
                    System.out.println(accordion.getExpandedPane().getText());
                }
            });

    g.getChildren().add(accordion);

    primaryStage.setScene(scene);
    primaryStage.show();
}