Java Reference
In-Depth Information
Table 13-10. JComboBox Properties
Property Name
Data Type
Access
accessibleContext
AccessibleContext
Read-only
action
Action
Read-write bound
actionCommand
String
Read-write
actionListeners
ActionListener[ ]
Read-only
editable
boolean
Read-write bound
editor
ComboBoxEditor
Read-write bound
enabled
boolean
Write-only bound
itemCount
int
Read-only
itemListeners
ItemListener[ ]
Read-only
keySelectionManager
JComboBox.KeySelectionManager
Read-write
lightWeightPopupEnabled
boolean
Read-write
maximumRowCount
int
Read-write bound
model
ComboBoxModel
Read-write bound
popupMenuListeners
PopupMenuListener[ ]
Read-only
popupVisible
boolean
Read-write
prototypeDisplayValue
Object
Read-write bound
renderer
ListCellRenderer
Read-write bound
selectedIndex
int
Read-write
selectedItem
Object
Read-write
selectedObjects
Object[ ]
Read-only
UI
ComboBoxUI
Read-write
UIClassID
String
Read-only
The significant properties of the JComboBox are concerned with the display of the pop-up
list. You can control the maximum number of visible entries in the pop-up list by setting the
maximumRowCount property. The lightWeightPopupEnabled property setting helps determine the
type of window to use when displaying the pop-up menu of choices. If the component fits
completely within the top-level window of the program, the component will be lightweight.
If it doesn't fit, it will be heavyweight. If you're mixing AWT and Swing components in
a program, you can force the pop-up menu of choices to be heavyweight by setting the
lightWeightPopupEnabled property to true . This will force the pop-up to appear above other
components. The remaining property related to the pop-up list is the popupVisible property,
which allows you to programmatically display the pop-up list.
Search WWH ::




Custom Search