import com.sun.javafx.runtime.VersionInfo; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.Node; import javafx.scene.control.Accordion; import javafx.scene.control.TitledPane; public class SampleApp extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { stage.setTitle(VersionInfo.getRuntimeVersion()); stage.setScene(createScene()); stage.show(); } private Scene createScene() { HBox root = new HBox(); Button b1 = new Button("Button 1"); Button b2 = new Button("Button 2"); final Node createControl = createControl(); CheckBox cb = new CheckBox("Focus traversable"); cb.selectedProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue ov, Boolean t, Boolean t1) { createControl.setFocusTraversable(t1); } }); root.getChildren().addAll(b1, createControl, b2, cb); return new Scene(root, 600, 400); } public Node createControl() { TitledPane pane1 = new TitledPane(); pane1.setGraphic(new javafx.scene.control.Label("title 1\nLong text long text")); pane1.setContent(new javafx.scene.shape.Rectangle(100, 40, javafx.scene.paint.Color.SKYBLUE)); TitledPane pane2 = new TitledPane(); pane2.setGraphic(new javafx.scene.control.Label("title 2\nLong text long text")); pane2.setContent(new javafx.scene.shape.Rectangle(100, 40, javafx.scene.paint.Color.BLUEVIOLET)); Accordion acc = new Accordion(); acc.getPanes().addAll(pane1, pane2); acc.setExpandedPane(pane2); pane2.setAnimated(false); acc.setFocusTraversable(false); acc.setMinWidth(100); return acc; } }