/* * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ package listviewgetsoutof; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ListView; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.RowConstraints; import javafx.scene.layout.StackPane; import javafx.stage.Stage; /** * * @author asakharu */ public class ListViewGetsOutOf extends Application { @Override public void start(Stage primaryStage) { GridPane root = new GridPane(); ColumnConstraints activeArea = new ColumnConstraints(); activeArea.setPercentWidth(50); ColumnConstraints eventTypesList = new ColumnConstraints(); eventTypesList.setPercentWidth(50); RowConstraints chiefControl = new RowConstraints(); chiefControl.setPercentHeight(50); RowConstraints helperControls = new RowConstraints(); helperControls.setPercentHeight(50); root.getColumnConstraints().addAll(activeArea, eventTypesList); root.getRowConstraints().addAll(chiefControl, helperControls); ListView lv = new ListView<>(); lv.getItems().addAll("one", "two", "three"); StackPane controlPane = new StackPane(); controlPane.setPadding(new Insets(10)); controlPane.getChildren().add(lv); root.add(controlPane, 0, 0); Scene scene = new Scene(root, 300, 300); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); } /** * The main() method is ignored in correctly deployed JavaFX application. * main() serves only as fallback in case the application can not be * launched through deployment artifacts, e.g., in IDEs with limited FX * support. NetBeans ignores main(). * * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }