package controls; import com.sun.javafx.collections.ObservableListWrapper; import com.sun.javafx.runtime.VersionInfo; import java.util.Arrays; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.ListView; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class DoListView extends Application { @Override public void start(Stage stage) { stage.setTitle(VersionInfo.getRuntimeVersion()); ListView list = new ListView(); ObservableListWrapper items = new ObservableListWrapper(Arrays.asList("One", "Two", "Three", "Four", "Five", "Six", "long line long line long line long line")); list.setItems(items); list.setMaxWidth(100); list.setMaxHeight(100); list.setFocusTraversable(false); list.setStyle("-fx-border-color:red;"); StackPane root = new StackPane(); root.getChildren().add(list); stage.setScene(new Scene(root, 300, 300)); stage.show(); } public static void main(String[] args) { launch(DoListView.class, args); } }