Example usage for javafx.scene.control ListView setEditable

List of usage examples for javafx.scene.control ListView setEditable

Introduction

In this page you can find the example usage for javafx.scene.control ListView setEditable.

Prototype

public final void setEditable(boolean value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    ObservableList<String> names = FXCollections.observableArrayList();
    ObservableList<String> data = FXCollections.observableArrayList();

    ListView<String> listView = new ListView<String>(data);
    listView.setPrefSize(200, 250);//  www.  ja va2  s . co m
    listView.setEditable(true);

    names.addAll("A", "B", "C", "D", "E");

    data.add("Double Click to Select Value");

    listView.setItems(data);
    listView.setCellFactory(ComboBoxListCell.forListView(names));

    StackPane root = new StackPane();
    root.getChildren().add(listView);
    primaryStage.setScene(new Scene(root, 200, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {

    ObservableList<String> data = FXCollections.observableArrayList();

    ListView<String> listView = new ListView<String>(data);
    listView.setPrefSize(200, 250);/*from   w w  w.  ja  va  2s  .c  o m*/
    listView.setEditable(true);

    data.addAll("A", "B", "C", "D", "E");

    listView.setItems(data);
    listView.setCellFactory((ListView<String> l) -> new ColorRectCell());
    StackPane root = new StackPane();
    root.getChildren().add(listView);
    primaryStage.setScene(new Scene(root, 200, 250));
    primaryStage.show();
}

From source file:Main.java

private void initializeListView(ListView<Student> listView) {
    listView.setPrefSize(250, 290);//from w  ww  .  ja va  2s.  c o  m
    listView.setEditable(false);
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listView.setCellFactory(new StringListCellFactory());
}