Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to declare a multi-select ListView in FXML?

alabala_kirilNov 23 2011 — edited Mar 21 2012
Hi there,


I have the following FXML form:
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<BorderPane xmlns:fx="http://javafx.com/fxml" fx:controller="form.FormController">
    <center>
        <GridPane alignment="top_center" hgap="8" vgap="8" style="-fx-padding: 10;">
            <children>
                <Label text="Template" GridPane.columnIndex="0" GridPane.rowIndex="0" />
                <ListView fx:id="template" prefHeight="100" GridPane.columnIndex="1" GridPane.rowIndex="0"/>

                <Label text="Template override" GridPane.columnIndex="0" GridPane.rowIndex="1" />
                <TextField fx:id="templateoverride" GridPane.columnIndex="1" GridPane.rowIndex="1"/>

                <Label text="Edit" GridPane.columnIndex="0" GridPane.rowIndex="2" />
                <ListView fx:id="write" prefHeight="100" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
               
                <Label text="Hide preview button" GridPane.columnIndex="0" GridPane.rowIndex="3" />
                <CheckBox fx:id="noPreview" GridPane.columnIndex="1" GridPane.rowIndex="3"/>                 
                
            </children>
        </GridPane>
    </center>
</BorderPane>
How can I declare that a ListView supports multi-select in the FXML?
Note that I load the form at runtime(I'm not aware of it's contents at compile time), so I can't bind the UI controls to the model beforehand.

At runtime, I am retrieving(via id) and populating the controls and I need to know if a given ListView supports multi-select?

Best
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2012
Added on Nov 23 2011
12 comments
3,359 views