public class ComboBox<T> extends List<T>
List
FIXED_CENTER, FIXED_LEAD, FIXED_NONE, FIXED_NONE_CYCLIC, FIXED_NONE_ONE_ELEMENT_MARGIN_FROM_EDGE, FIXED_TRAIL, HORIZONTAL, VERTICAL
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, LEFT, RIGHT, TOP
Constructor and Description |
---|
ComboBox()
Constructs an empty combo box
|
ComboBox(ListModel<T> model)
Creates a new instance of ComboBox
|
ComboBox(Object[] items)
Creates a new instance of ComboBox
|
ComboBox(Vector<T> items)
Creates a new instance of ComboBox
|
Modifier and Type | Method and Description |
---|---|
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content.
|
protected Dialog |
createPopupDialog(List<T> l)
Subclasses can override this method to change the creation of the dialog
|
protected List<T> |
createPopupList()
Creates the list object used within the popup dialog.
|
protected void |
fireClicked()
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method
in order to allow 3 button devices to work properly.
|
int |
getBaseline(int width,
int height)
The baseline for the component text according to which it should be aligned
with other components for best visual look.
|
int |
getOrientation()
Returns the list orientation
|
Rectangle |
getSelectedRect()
Returns the component bounds with absolute screen coordinates, for components that include an internal selection behavior
and are not containers (currently only List) this method allows returning the position of the selection
itself which is useful for things such as the popup dialog and similar UI's that need to reference the
position of the selection externally
|
protected Rectangle |
getVisibleBounds()
Returns the component bounds for scrolling which might differ from the getBounds for large components
e.g.
|
boolean |
isActAsSpinnerDialog()
When this flag is active the combo box acts as a button that opens a dialog that looks like a spinner
this allows creating user interfaces for touch devices where a spinner UI approach is more common than
a combo box paradigm.
|
static boolean |
isDefaultActAsSpinnerDialog()
When this flag is active the combo box acts as a button that opens a dialog that looks like a spinner
this allows creating user interfaces for touch devices where a spinner UI approach is more common than
a combo box paradigm.
|
static boolean |
isDefaultIncludeSelectCancel()
Indicates whethe the soft buttons for select/cancel should appear for the combo box by default
|
boolean |
isIncludeSelectCancel()
Indicates whethe the soft buttons for select/cancel should appear for the combo box
|
void |
keyReleased(int keyCode)
If this Component is focused, the key released event
will call this method
|
protected void |
laidOut()
This is a callback method to inform the Component when it's been laidout
on the parent Container
|
void |
paint(Graphics g)
This method paints the Component on the screen, it should be overriden
by subclasses to perform custom drawing or invoke the UI API's to let
the PLAF perform the rendering.
|
void |
pointerDragged(int x,
int y)
If this Component is focused, the pointer dragged event
will call this method
|
void |
pointerHover(int[] x,
int[] y)
Invoked for devices where the pointer can hover without actually clicking
the display.
|
void |
pointerHoverReleased(int[] x,
int[] y)
Invoked for devices where the pointer can hover without actually clicking
the display.
|
void |
pointerPressed(int x,
int y)
If this Component is focused, the pointer pressed event
will call this method
|
void |
pointerReleased(int x,
int y)
If this Component is focused, the pointer released event
will call this method
|
void |
setActAsSpinnerDialog(boolean actAsSpinnerDialog)
When this flag is active the combo box acts as a button that opens a dialog that looks like a spinner
this allows creating user interfaces for touch devices where a spinner UI approach is more common than
a combo box paradigm.
|
static void |
setDefaultActAsSpinnerDialog(boolean aDefaultActAsSpinnerDialog)
When this flag is active the combo box acts as a button that opens a dialog that looks like a spinner
this allows creating user interfaces for touch devices where a spinner UI approach is more common than
a combo box paradigm.
|
static void |
setDefaultIncludeSelectCancel(boolean aDefaultIncludeSelectCancel)
Indicates whethe the soft buttons for select/cancel should appear for the combo box by default
|
void |
setIncludeSelectCancel(boolean includeSelectCancel)
Indicates whethe the soft buttons for select/cancel should appear for the combo box
|
void |
setSelectedIndex(int selection)
Sets the current selected offset in the list, by default this implementation
will scroll the list to the selection if the selection is outside of the screen
|
void |
setSelectedIndex(int selection,
boolean scroll)
Sets the current selected offset in the list
|
void |
setUIID(String uiid)
This method sets the Component the Unique identifier.
|
protected Command |
showPopupDialog(Dialog popupDialog,
List l)
Shows the popup dialog for the combo box and returns the resulting command.
|
addActionListener, addItem, addSelectionListener, animate, fireActionEvent, fireActionEvent, getActionListeners, getCurrentSelected, getDragRegionStatus, getFixedSelection, getGridPosX, getGridPosY, getHint, getHintIcon, getItemGap, getListeners, getListSizeCalculationSampleCount, getMaxElementHeight, getMinElementHeight, getModel, getRenderer, getRenderingPrototype, getSelectedIndex, getSelectedItem, getSideGap, initLaf, isCommandList, isDefaultFireOnClick, isDefaultIgnoreFocusComponentWhenUnfocused, isIgnoreFocusComponentWhenUnfocused, isLongPointerPressActionEnabled, isMutableRendererBackgrounds, isNumericKeyActions, isScrollableX, isScrollableY, isSelectableInteraction, isTactileTouch, keyPressed, listSelectionChanged, longPointerPress, modelChanged, paramString, refreshTheme, removeActionListener, removeSelectionListener, scrollRectToVisible, setCommandList, setDefaultFireOnClick, setDefaultIgnoreFocusComponentWhenUnfocused, setFireOnClick, setFixedSelection, setHandlesInput, setHint, setHint, setHintIcon, setIgnoreFocusComponentWhenUnfocused, setInputOnFocus, setItemGap, setListCellRenderer, setListSizeCalculationSampleCount, setLongPointerPressActionEnabled, setMaxElementHeight, setMinElementHeight, setModel, setMutableRendererBackgrounds, setNumericKeyActions, setOrientation, setPaintFocusBehindList, setRenderer, setRenderingPrototype, setScrollToSelected, setSelectedItem, setShouldCalcPreferredSize, shouldRenderSelection, size
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, bindProperty, calcScrollSize, cancelRepaints, clearClientProperties, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBottomGap, getBoundPropertyValue, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragSpeed, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getStyle, getTensileLength, getUIID, getUIManager, getUnselectedStyle, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollVisible, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, longKeyPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pinch, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, resetFocusable, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBoundPropertyValue, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, styleChanged, toString, unbindProperty
public ComboBox(Vector<T> items)
items
- set of items placed into the combo box modelpublic ComboBox(Object[] items)
items
- set of items placed into the combo box modelpublic ComboBox()
public static boolean isDefaultActAsSpinnerDialog()
public static void setDefaultActAsSpinnerDialog(boolean aDefaultActAsSpinnerDialog)
aDefaultActAsSpinnerDialog
- the defaultActAsSpinnerDialog to setpublic void setUIID(String uiid)
Component
public int getBaseline(int width, int height)
Component
getBaseline
in class Component
width
- the component widthheight
- the component heightprotected void laidOut()
Component
public Rectangle getSelectedRect()
Component
getSelectedRect
in class List<T>
protected Rectangle getVisibleBounds()
Component
getVisibleBounds
in class List<T>
Component.getX()
,
Component.getY()
public void setSelectedIndex(int selection)
List
setSelectedIndex
in class List<T>
selection
- the current selected offset in the listpublic void setSelectedIndex(int selection, boolean scroll)
List
setSelectedIndex
in class List<T>
selection
- the current selected offset in the listscroll
- indicates whether scrolling to selection should
occur if the selection is outside of viewpublic void pointerHover(int[] x, int[] y)
Component
pointerHover
in class List<T>
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerHoverReleased(int[] x, int[] y)
Component
pointerHoverReleased
in class List<T>
x
- the pointer x coordinatey
- the pointer y coordinateprotected Dialog createPopupDialog(List<T> l)
l
- the list of the popupprotected Command showPopupDialog(Dialog popupDialog, List l)
popupDialog
- the popup dialogl
- the list withinprotected void fireClicked()
Component
fireClicked
in class List<T>
protected List<T> createPopupList()
public void keyReleased(int keyCode)
Component
keyReleased
in class List<T>
keyCode
- the key code value to indicate a physical key.public void pointerPressed(int x, int y)
Component
pointerPressed
in class List<T>
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerDragged(int x, int y)
Component
pointerDragged
in class List<T>
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerReleased(int x, int y)
Component
pointerReleased
in class List<T>
x
- the pointer x coordinatey
- the pointer y coordinatepublic void paint(Graphics g)
Component
protected Dimension calcPreferredSize()
Component
calcPreferredSize
in class List<T>
public int getOrientation()
List
getOrientation
in class List<T>
List.HORIZONTAL
,
List.VERTICAL
public boolean isIncludeSelectCancel()
public void setIncludeSelectCancel(boolean includeSelectCancel)
includeSelectCancel
- the new valuepublic static boolean isDefaultIncludeSelectCancel()
public static void setDefaultIncludeSelectCancel(boolean aDefaultIncludeSelectCancel)
aDefaultIncludeSelectCancel
- the new valuepublic boolean isActAsSpinnerDialog()
public void setActAsSpinnerDialog(boolean actAsSpinnerDialog)
actAsSpinnerDialog
- the actAsSpinnerDialog to set