package tests; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Accordion; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.Hyperlink; import javafx.scene.control.ScrollPane; import javafx.scene.control.TextField; import javafx.scene.control.TitledPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; import javafx.stage.Stage; /** * * @author jcambon */ public class TestTabNavigation extends Application { private int rowIndex = 0; /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(TestTabNavigation.class, (java.lang.String[]) null); } @Override public void start(Stage primaryStage) { final GridPane gridPane = new GridPane(); // gridPane.add(new Hyperlink("test"), 0, rowIndex); // gridPane.add(new TextField(), 1, rowIndex); // gridPane.add(new MenuButton(), 2, rowIndex); // rowIndex++; // gridPane.add(new TextField(), 1, rowIndex); // rowIndex++; // TextField tf = new TextField(); // tf.setDisable(true); // gridPane.add(tf, 1, rowIndex); // rowIndex++; // gridPane.add(new CheckBox(), 1, rowIndex); // rowIndex++; // gridPane.add(new TextField(), 1, rowIndex); // rowIndex++; // gridPane.add(new Hyperlink("test hyperlink"), 0, rowIndex); // gridPane.add(new TextField(), 1, rowIndex); // rowIndex++; ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(gridPane); TitledPane titledPane = new TitledPane(); titledPane.setContent(scrollPane); // titledPane.setContent(gridPane); Button button = new Button("Add row"); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent t) { gridPane.add(new Hyperlink(new Integer(rowIndex).toString()), 0, rowIndex); gridPane.add(new TextField(), 1, rowIndex); rowIndex++; gridPane.add(new Hyperlink(new Integer(rowIndex).toString()), 0, rowIndex); gridPane.add(new CheckBox(), 1, rowIndex); rowIndex++; gridPane.add(new Hyperlink(new Integer(rowIndex).toString()), 0, rowIndex); gridPane.add(new TextField(), 1, rowIndex); rowIndex++; } }); Button button2 = new Button("Reset"); button2.setOnAction(new EventHandler() { @Override public void handle(ActionEvent t) { gridPane.getChildren().clear(); rowIndex = 0; } }); TitledPane titledPane2 = new TitledPane(); titledPane2.setContent(new TextField()); Accordion accordion = new Accordion(); accordion.getPanes().addAll(titledPane, titledPane2); VBox vbox = new VBox(20); // VBox.setVgrow(titledPane, Priority.ALWAYS); VBox.setVgrow(accordion, Priority.ALWAYS); // vbox.getChildren().addAll(titledPane, titledPane2, button, button2); vbox.getChildren().addAll(accordion, button, button2); Scene scene = new Scene(vbox); primaryStage.setWidth(300); primaryStage.setHeight(400); primaryStage.setScene(scene); primaryStage.setTitle("test ChoiceBoxIssue"); primaryStage.show(); } }