Java Code Examples for javafx.scene.control.ListView#setItems()

The following examples show how to use javafx.scene.control.ListView#setItems() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListViewCellFactorySample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ListViewCellFactorySample() {
    final ListView<Number> listView = new ListView<Number>();
    listView.setItems(FXCollections.<Number>observableArrayList(
            100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00,
            430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00,
            15.00, 47.50, 12.11

    ));
    
    listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() {
        @Override public ListCell<Number> call(ListView<java.lang.Number> list) {
            return new MoneyFormatCell();
        }
    });        
    
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example 2
Source File: ListViewCellFactorySample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ListViewCellFactorySample() {
    final ListView<Number> listView = new ListView<Number>();
    listView.setItems(FXCollections.<Number>observableArrayList(
            100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00,
            430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00,
            15.00, 47.50, 12.11

    ));
    
    listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() {
        @Override public ListCell<Number> call(ListView<java.lang.Number> list) {
            return new MoneyFormatCell();
        }
    });        
    
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example 3
Source File: SimpleListViewScrollSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
            "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
            "Row 19", "Row 20", "Row 21", "Row 22", "Row 23", "Row 24", "Row 25"));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    Button button = new Button("Debug");
    button.setOnAction((e) -> {
        ObservableList<Integer> selectedIndices = listView.getSelectionModel().getSelectedIndices();
        for (Integer index : selectedIndices) {
            ListCell cellAt = getCellAt(listView, index);
            System.out.println("SimpleListViewScrollSample.SimpleListViewScrollSampleApp.start(" + cellAt + ")");
        }
    });
    VBox root = new VBox(listView, button);
    primaryStage.setScene(new Scene(root, 300, 400));
    primaryStage.show();
}
 
Example 4
Source File: SimpleListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SimpleListViewSample() {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList(
            "Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6",
            "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13",
            "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20"
    ));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example 5
Source File: HorizontalListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public HorizontalListViewSample() {
    ListView horizontalListView = new ListView();
    horizontalListView.setOrientation(Orientation.HORIZONTAL);
    horizontalListView.setItems(FXCollections.observableArrayList(
            "Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6",
            "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13",
            "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20"
    ));
    getChildren().add(horizontalListView);
}
 
Example 6
Source File: SimpleListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SimpleListViewSample() {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList(
            "Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6",
            "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13",
            "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20"
    ));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example 7
Source File: HorizontalListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public HorizontalListViewSample() {
    ListView horizontalListView = new ListView();
    horizontalListView.setOrientation(Orientation.HORIZONTAL);
    horizontalListView.setItems(FXCollections.observableArrayList(
            "Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6",
            "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13",
            "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20"
    ));
    getChildren().add(horizontalListView);
}
 
Example 8
Source File: TextFieldListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public TextFieldListViewSample() {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
            "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
            "Row 19", "Row 20"));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listView.setEditable(true);
    listView.setCellFactory(TextFieldListCell.forListView());
    getChildren().add(listView);
}
 
Example 9
Source File: SimpleListViewScrollSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SimpleListViewScrollSample() {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
            "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
            "Row 19", "Row 20", "Row 21", "Row 22", "Row 23", "Row 24", "Row 25"));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example 10
Source File: GitFxDialog.java    From GitFx with Apache License 2.0 5 votes vote down vote up
@Override
public String gitFxInformationListDialog(String title, String header, String label,List list){
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(label);
    ListView<String> listView = new ListView<>();
    listView.setItems(FXCollections.observableArrayList(list));
    alert.getDialogPane().setContent(listView);
    alert.showAndWait();
    //TODO Need to return the logged newValue for further JGit code to sync
    //a repository
    return null ;
}