示例#1
0
  @Override
  public void start(Stage stage) throws Exception {

    this.mainBorderPane = new BorderPane();

    FlowPane toolbar = new FlowPane();

    Button btnClear = new Button("Clear");

    btnClear.setOnAction(
        event -> {
          root.getChildren().clear();
        });
    Button btnLoadFtof = new Button("FTOF");

    btnLoadFtof.setOnAction(
        event -> {
          loadDetector("FTOF");
        });

    toolbar.getChildren().add(btnClear);
    toolbar.getChildren().add(btnLoadFtof);

    SplitPane splitPane = new SplitPane();
    StackPane treePane = new StackPane();

    root = new Group();
    BorderPane pane = new BorderPane();

    treeView = new TreeView<String>();

    treePane.getChildren().add(treeView);

    this.content = new ContentModel(800, 800, 200);
    this.content.setContent(root);

    content.getSubScene().heightProperty().bind(pane.heightProperty());
    content.getSubScene().widthProperty().bind(pane.widthProperty());

    pane.setCenter(content.getSubScene());
    mainBorderPane.setTop(toolbar);
    splitPane.getItems().addAll(treePane, pane);
    splitPane.setDividerPositions(0.2);

    // this.addDetector("FTOF");
    // this.test();
    this.testFTOF();
    // this.testDC();
    // this.testBST();
    // final Scene scene = new Scene(pane, 880, 880, true);
    this.mainBorderPane.setCenter(splitPane);
    HBox statusPane = new HBox();

    ColorPicker colorPicker = new ColorPicker();
    colorPicker.setOnAction(
        new EventHandler() {
          @Override
          public void handle(Event event) {
            content.setBackgroundColor(colorPicker.getValue());
          }
        });
    statusPane.getChildren().add(colorPicker);
    this.mainBorderPane.setBottom(statusPane);

    final Scene scene = new Scene(mainBorderPane, 1280, 880, true);

    scene.setFill(Color.ALICEBLUE);
    stage.setTitle("CLAS12 Geometry Viewer - JavaFX3D");
    stage.setScene(scene);
    stage.show();
  }