List of usage examples for javafx.scene.control ListView setMaxWidth
public final void setMaxWidth(double value)
From source file:Main.java
private ListView<Person> createLeaderListView(ObservableList<Person> leaders) { final ListView<Person> leaderListView = new ListView<>(leaders); leaderListView.setPrefWidth(150);//from w w w .j a v a2 s . c om leaderListView.setMaxWidth(Double.MAX_VALUE); leaderListView.setPrefHeight(150); leaderListView.setCellFactory(new Callback<ListView<Person>, ListCell<Person>>() { @Override public ListCell<Person> call(ListView<Person> param) { Tooltip tooltip = new Tooltip(); ListCell<Person> cell = new ListCell<Person>() { @Override public void updateItem(Person item, boolean empty) { super.updateItem(item, empty); if (item != null) { // leadLbl.setText(item.getAliasName()); setText(item.getFirstName() + " " + item.getLastName()); tooltip.setText(item.getAliasName()); setTooltip(tooltip); } } }; return cell; } }); return leaderListView; }