/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import com.sun.javafx.runtime.VersionInfo; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Accordion; import javafx.scene.control.TitledPane; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; /** * * @author cementovoz */ public class JavaApplication25 extends Application { @Override public void start(Stage stage) throws Exception { Accordion c = createControl(); Scene scene = new Scene(c, 300, 300); stage.setScene(scene); scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm()); stage.show(); stage.setTitle(VersionInfo.getRuntimeVersion()); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } public Accordion createControl() { TitledPane pane1 = new TitledPane(); pane1.setText("title 1\nLong text long text"); pane1.setContent(new Rectangle(100, 40, Color.SKYBLUE)); pane1.setFocusTraversable(false); TitledPane pane2 = new TitledPane(); pane2.setText("title 2\nLong text long text"); pane2.setContent(new Rectangle(100, 40, Color.BLUEVIOLET)); Accordion acc = new Accordion(); acc.getPanes().addAll(pane1, pane2); acc.setExpandedPane(pane2); pane2.setAnimated(false); pane2.setFocusTraversable(false); acc.setFocusTraversable(false); return acc; } }