/** * Copyright (c) 2008, 2011 Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. */ import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.control.ListView; import javafx.scene.control.ListCell; import javafx.collections.ObservableList; import javafx.collections.FXCollections; import javafx.scene.control.cell.TextFieldListCell; import javafx.stage.Screen; import javafx.geometry.Rectangle2D; public class VK_ListView extends Application { private void init(final Stage primaryStage) { Rectangle2D screenBounds = Screen.getPrimary().getBounds(); System.out.println("VK_ListView: Screen size: " + screenBounds.getWidth() + " x " + screenBounds.getHeight()); primaryStage.setWidth(screenBounds.getWidth()); primaryStage.setHeight(screenBounds.getHeight()); Group root = new Group(); primaryStage.setScene(new Scene(root)); ObservableList names = FXCollections.observableArrayList("Julia", "Ian", "Sue", "Matthew", "Hannah", "Stephan", "Denise"); ListView listView = new ListView(names); listView.setPrefHeight(200); listView.setTranslateX(200); listView.setTranslateY(screenBounds.getHeight() - 385); listView.setEditable(true); listView.setCellFactory(TextFieldListCell.forListView()); root.getChildren().add(listView); } @Override public void start(final Stage primaryStage) throws Exception { init(primaryStage); primaryStage.show(); } public static void main(String[] args) { launch(args); } }