Example usage for javafx.scene.control TreeTableView setTableMenuButtonVisible

List of usage examples for javafx.scene.control TreeTableView setTableMenuButtonVisible

Introduction

In this page you can find the example usage for javafx.scene.control TreeTableView setTableMenuButtonVisible.

Prototype

public final void setTableMenuButtonVisible(boolean value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    root.setExpanded(true);// w  w  w  .j  a v  a  2 s . co m
    employees.stream().forEach((employee) -> {
        root.getChildren().add(new TreeItem<>(employee));
    });
    Scene scene = new Scene(new Group(), 400, 400);
    Group sceneRoot = (Group) scene.getRoot();

    TreeTableColumn<Employee, String> empColumn = new TreeTableColumn<>("Employee");
    empColumn.setPrefWidth(150);
    empColumn.setCellValueFactory(
            (TreeTableColumn.CellDataFeatures<Employee, String> param) -> new ReadOnlyStringWrapper(
                    param.getValue().getValue().getName()));

    TreeTableColumn<Employee, String> emailColumn = new TreeTableColumn<>("Email");
    emailColumn.setPrefWidth(190);
    emailColumn.setCellValueFactory(
            (TreeTableColumn.CellDataFeatures<Employee, String> param) -> new ReadOnlyStringWrapper(
                    param.getValue().getValue().getEmail()));

    TreeTableView<Employee> treeTableView = new TreeTableView<>(root);
    treeTableView.getColumns().setAll(empColumn, emailColumn);

    treeTableView.setTableMenuButtonVisible(true);

    sceneRoot.getChildren().add(treeTableView);
    stage.setScene(scene);
    stage.show();
}