Java Reference
In-Depth Information
scene: Scene {
fill:LinearGradient {
startX: 0, endX: 0, startY: 0, endY: 1
stops: [
Stop { offset: 0, color: Color.GRAY }
Stop { offset: 1, color: Color.WHITESMOKE }
]
}
content: [listView]
}
}
When executed, the code produces the following list:
How it works...
The ListView control allows you to arrange and display data in a vertical list. This
control makes available several properties, including selectedIndex and selectedItem,
to access the currently selected item in the list. The ListView class also exposes the
items:Object[] property as the list's data model displayed in the List instance. In
our example, we dynamically generate the data model as a sequence of 50 strings using
a for-loop expression and assign that sequence directly to the list's items property.
As of version 1.2, the ListView component only displays textual items in
the list. The component does not allow you to use, say, a Node class as its
model. Therefore, you cannot create custom lists that display non-textual
items. This will certainly be improved in future versions.
 
Search WWH ::




Custom Search