Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit
Class ComboBox

java.lang.Object
  extended by com.sun.dtv.lwuit.Component
      extended by com.sun.dtv.lwuit.List
          extended by com.sun.dtv.lwuit.ComboBox
All Implemented Interfaces:
Animation, StyleListener, Animated, MatteEnabled, ViewOnlyComponent

public class ComboBox
extends List

A combo box is a list that allows only one selection at a time, when a user clicks the combo box a popup button with the full list of elements allows the selection of a single element. The combo box is driven by the list model and allows all the renderer features of the List as well.

See Also:
List

Field Summary
 
Fields inherited from class com.sun.dtv.lwuit.List
FIXED_CENTER, FIXED_LEAD, FIXED_NONE, FIXED_NONE_CYCLIC, FIXED_NONE_ONE_ELEMENT_MARGIN_FROM_EDGE, FIXED_TRAIL, HORIZONTAL, VERTICAL
 
Fields inherited from class com.sun.dtv.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Fields inherited from interface com.sun.dtv.ui.ViewOnlyComponent
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, SCALE_ASPECT_PROOF, SCALE_NO, SCALE_NO_ASPECT_PROOF, STATE_DISABLED, STATE_ENABLED, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_TOP
 
Fields inherited from interface com.sun.dtv.ui.Animated
ALTERNATING, LOOP, REPEATING
 
Constructor Summary
ComboBox()
          Constructs an empty combo box.
ComboBox(ListModel model)
          Creates a new instance of ComboBox.
ComboBox(Object[] items)
          Creates a new instance of ComboBox.
ComboBox(Vector items)
          Creates a new instance of ComboBox.
 
Method Summary
 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.
 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 pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method.
 void setHandlesInput(boolean handlesInput)
          Prevents key events from being grabbed for focus traversal.
 void setModel(ListModel m)
          Replaces/sets the model underlying the list.
 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.
 
Methods inherited from class com.sun.dtv.lwuit.List
addActionListener, addItem, addSelectionListener, animate, getAnimateContent, getBorderGap, getFixedSelection, getGraphicContent, getHorizontalAlignment, getInteractionState, getItemGap, getMatte, getModel, getOrientation, getRenderer, getRenderingPrototype, getScalingMode, getSelectedIndex, getSelectedItem, getTextContent, getTextLayoutManager, getVerticalAlignment, isDoubleBuffered, isNumericKeyActions, isOpaque, isScrollableX, isScrollableY, keyPressed, keyReleased, pointerDragged, processEvent, refreshTheme, removeActionListener, removeSelectionListener, scrollRectToVisible, setAnimateContent, setBorderGap, setFixedSelection, setGraphicContent, setHorizontalAlignment, setInputOnFocus, setInteractionState, setItemGap, setListCellRenderer, setMatte, setNumericKeyActions, setOrientation, setPaintFocusBehindList, setRenderingPrototype, setScalingMode, setSelectedItem, setTextContent, setTextLayoutManager, setVerticalAlignment, size
 
Methods inherited from class com.sun.dtv.lwuit.Component
addFocusListener, calcPreferredSize, contains, deinitialize, getAbsoluteX, getAbsoluteY, getAnimationMode, getBaselineResizeBehavior, getBottomGap, getBounds, getClientProperty, getComponentForm, getDelay, getHeight, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPosition, getPreferredSize, getRepetitionMode, getScrollAnimationSpeed, getScrollX, getScrollY, getSideGap, getStyle, getUIID, getWidth, getX, getY, handlesInput, hasFocus, initialize, isEnabled, isFocusable, isFocusPainted, isInitialized, isRunning, isScrollVisible, isSmoothScrolling, isVisible, jumpTo, keyRepeated, longKeyPress, paintBackgrounds, paintComponent, paintComponent, pointerPressed, putClientProperty, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, setAnimationMode, setCellRenderer, setDelay, setEnabled, setFocus, setFocusable, setFocusPainted, setHeight, setInitialized, setIsScrollVisible, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredSize, setRepetitionMode, setScrollAnimationSpeed, setScrollX, setScrollY, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setStyle, setUIID, setVisible, setWidth, setX, setY, start, stop, styleChanged, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComboBox

public ComboBox(Vector items)
Creates a new instance of ComboBox.

Parameters:
items - set of items placed into the combo box model

ComboBox

public ComboBox(Object[] items)
Creates a new instance of ComboBox.

Parameters:
items - set of items placed into the combo box model

ComboBox

public ComboBox()
Constructs an empty combo box.


ComboBox

public ComboBox(ListModel model)
Creates a new instance of ComboBox.

Parameters:
model - the model for the combo box elements and selection
Method Detail

getBaseline

public int getBaseline(int width,
                       int height)
Description copied from class: Component
The baseline for the component text according to which it should be aligned with other components for best visual look.

Overrides:
getBaseline in class Component
Parameters:
width - the component width
height - the component height
Returns:
baseline value from the top of the component

setSelectedIndex

public void setSelectedIndex(int selection)
Description copied from class: List
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.

Overrides:
setSelectedIndex in class List
Parameters:
selection - the current selected offset in the list
See Also:
List.getSelectedIndex()

setSelectedIndex

public void setSelectedIndex(int selection,
                             boolean scroll)
Description copied from class: List
Sets the current selected offset in the list.

Overrides:
setSelectedIndex in class List
Parameters:
selection - the current selected offset in the list
scroll - indicates whether scrolling to selection should occur if the selection is outside of view
See Also:
List.getSelectedIndex()

setModel

public void setModel(ListModel m)
Description copied from class: List
Replaces/sets the model underlying the list.

Overrides:
setModel in class List
Parameters:
m - the new model underlying the list
See Also:
List.getModel()

setHandlesInput

public void setHandlesInput(boolean handlesInput)
Description copied from class: Component
Prevents key events from being grabbed for focus traversal. E.g. a list component might use the arrow keys for internal navigation so it will switch this flag to true in order to prevent the focus manager from moving to the next component.

Overrides:
setHandlesInput in class List
Parameters:
handlesInput - indicates whether key events can be grabbed for focus traversal

pointerReleased

public void pointerReleased(int x,
                            int y)
Description copied from class: Component
If this Component is focused, the pointer released event will call this method.

Overrides:
pointerReleased in class List
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

paint

public void paint(Graphics g)
Description copied from class: Component
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.

Specified by:
paint in interface Animation
Specified by:
paint in interface ViewOnlyComponent
Overrides:
paint in class List
Parameters:
g - the component graphics

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.