Java DTV API 1.0
12-Dec-2008

com.sun.lwuit
Class ComboBox

java.lang.Object
  extended bycom.sun.lwuit.Component
      extended bycom.sun.dtv.ui.MatteEnabledComponent
          extended bycom.sun.dtv.ui.ViewOnlyComponent
              extended bycom.sun.lwuit.List
                  extended bycom.sun.lwuit.ComboBox
All Implemented Interfaces:
Animated, MatteEnabled, StyleListener

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.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.ui.ViewOnlyComponent
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, SCALE_ASPECT_PROOF, SCALE_NO, SCALE_NO_ASPECT_PROOF, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_TOP
 
Fields inherited from class com.sun.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.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
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
 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.
protected  String getUIID()
          Unique identifier for a component, must be overriden for a component so a style can be applied to the component.
protected  void modelChanged(int status)
          Reset popup data on model change to allow the popup to refresh with the right details.
 void paint(Graphics g)
          Method to paint the component.
 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.lwuit.List
addActionListener, addItem, addSelectionListener, animate, fireActionEvent, fireClicked, getBorderGap, getFixedSelection, getItemGap, getModel, getOrientation, getRenderer, getRenderingPrototype, getSelectedIndex, getSelectedItem, initComponent, isNumericKeyActions, isScrollableX, isScrollableY, isSelectableInteraction, keyPressed, keyReleased, modelChanged, paramString, pointerDragged, refreshTheme, removeActionListener, removeSelectionListener, scrollRectToVisible, setBorderGap, setFixedSelection, setInputOnFocus, setItemGap, setListCellRenderer, setNumericKeyActions, setOrientation, setPaintFocusBehindList, setRenderingPrototype, setSelectedItem, size
 
Methods inherited from class com.sun.dtv.ui.ViewOnlyComponent
getAnimateContent, getGraphicContent, getHorizontalAlignment, getInteractionState, getScalingMode, getTextContent, getTextLayoutManager, getVerticalAlignment, isOpaque, setAnimateContent, setGraphicContent, setHorizontalAlignment, setInteractionState, setScalingMode, setTextContent, setTextLayoutManager, setVerticalAlignment
 
Methods inherited from class com.sun.dtv.ui.MatteEnabledComponent
getMatte, isDoubleBuffered, processEvent, setMatte
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, contains, deinitialize, getAbsoluteX, getAbsoluteY, getAnimationMode, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDelay, getHeight, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPosition, getPreferredSize, getRepetitionMode, getScrollAnimationSpeed, getScrollX, getScrollY, getSideGap, getStyle, getWidth, getX, getY, handlesInput, hasFocus, isEnabled, isFocusable, isFocusPainted, isInitialized, isRunning, isScrollable, isScrollVisible, isSmoothScrolling, isVisible, jumpTo, keyRepeated, longKeyPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerPressed, putClientProperty, refreshTheme, 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, 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

getUIID

protected String getUIID()
Description copied from class: Component
Unique identifier for a component, must be overriden for a component so a style can be applied to the component.

Overrides:
getUIID in class List

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

modelChanged

protected void modelChanged(int status)
Reset popup data on model change to allow the popup to refresh with the right details.

Parameters:
status - the model status

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

paint

public void paint(Graphics g)
Description copied from class: ViewOnlyComponent
Method to paint the component.

Specified by:
paint in interface Animated
Overrides:
paint in class List

calcPreferredSize

protected Dimension calcPreferredSize()
Description copied from class: Component
Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

Overrides:
calcPreferredSize in class List

Java DTV API 1.0
12-Dec-2008

Copyright © 2008 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.