![]() |
![]() |
![]() |
![]() |
Listbox (JList)
A JList shows a list of a set of items. In order to include a scrollbar, a JList must be placed inside of a JScrollPane. The user can select either one or multiple items depending on the 'Selection Mode'. The Visible rows entry field indicates the number of rows that are displayed when a JList is placed inside of a JScrollPane. The 'Prototype Value for Sizing' is a text string whose display width determines the preferred width of the JList.
The JList can be used in two ways. The first is by specifying a static set of text entries in the 'JList items' area (each one on a line). The second, and more powerful, is to use a ListModel. A ListModel lets the user fully describe the contents of the JList in an abstract manner to create dynamic contents. See the JDK API reference and documentation for further details.
A List will generate an ItemEvent whenever the user chooses an item.
A List will generate an ActionEvent whenever the user presses the 'Enter' key while the Listbox has the focus.
Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |
![]() |
![]() |
![]() |
![]() |