To reproduce run following code
import com.sun.javafx.collections.ObservableListWrapper;
import java.util.Arrays;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ListViewSample1 extends Application {
public static void main(String[] args) {
launch( args);
}
private Parent getContent() {
VBox box = new VBox(10);
ListView list = new ListView();
ObservableList<String> items = new ObservableListWrapper<String>(Arrays.asList("One", "Two", "Three", "Four", "Five", "Six", "long\n line\n long\n line long\n line\n long\n line"));
list.setItems(items);
list.setMaxWidth(100);
list.setMaxHeight(100);
list.setStyle("-fx-shape: "
+ "\"M 50 50 L 150 50 L 100 150 Z\";-fx-background-color: red;");
box.getChildren().add(list);
return box;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}
import com.sun.javafx.collections.ObservableListWrapper;
import java.util.Arrays;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ListViewSample1 extends Application {
public static void main(String[] args) {
launch( args);
}
private Parent getContent() {
VBox box = new VBox(10);
ListView list = new ListView();
ObservableList<String> items = new ObservableListWrapper<String>(Arrays.asList("One", "Two", "Three", "Four", "Five", "Six", "long\n line\n long\n line long\n line\n long\n line"));
list.setItems(items);
list.setMaxWidth(100);
list.setMaxHeight(100);
list.setStyle("-fx-shape: "
+ "\"M 50 50 L 150 50 L 100 150 Z\";-fx-background-color: red;");
box.getChildren().add(list);
return box;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}