All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.awt
Class ListBox

    com.sas.awt.ListBox

All Implemented Interfaces:
  VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.collection.ContentsChangedListener, com.sas.ComponentInterface, com.sas.lang.StringDataInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.PublicClonable, com.sas.ViewDefaultModelInterface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible

    public class ListBox

implements com.sas.collection.ContentsChangedListener, com.sas.lang.StringDataInterface, com.sas.PublicClonable, com.sas.ViewDefaultModelInterface

ListBox is a component that maintains a scrollable list of items for selection. Setting the multipleMode property to true will allow more than one item to be selected. The multipleMode property is initially set to false.
Creation:

1. Create a Listbox
   `ListBox listBox1 = new ListBox();`
   `listBox1.initialize();`
2. Create a Listbox with the specified number of visible rows
   `ListBox listBox1 = new ListBox(rows)`;
   `listBox1.initialize();`
   where rows is an integer that specifies the number of visible rows in the listBox
3. Create a Listbox with the specified number of visible rows and the specified value of the multipleMode property
   `ListBox listBox1 = new ListBox(rows, multipleMode);`
   `listBox1.initialize();`
   where:
   - rows is an integer that specifies the number of visible rows in the listBox
   - multipleMode is a boolean that specifies whether multiple selections are allowed

Default Size:

- height = 124
- width = 124

Required Interfaces:
The ListBox requires a model that implements com.sas.collection.StaticOrderedCollectionInterface. A default model is automatically created and attached to the listbox when the ListBox is initially constructed. If the listbox is constructed in a design-time environment, the default model contains two items -- "Item 1" and "Item 2".
Events:
The ListBox sends out an ItemEvent when an item is selected or deselected in the list. An ActionEvent is sent when an item is double clicked.
Notes:

- The ListBox implements the com.sas.collection.ContentsChangedListener, com.sas.PublicClonable, and com.sas.lang.StringData interfaces.
- Transforms can be used when the information in the model needs to be changed to a different type to be used for output, input, or display.
- The items in the list can be modified (additions, insertions, removals) only if the attached model implements the OrderedCollectionInterface.
- The multipleSelectionStyle property sets the multiple selection style. The STANDARD_AWT setting is simply the AWT method of selecting multiple items where each item must be selected individually. The EXTENDED_SELECT style allows multiple selections through the use of the Control and/or Shift keys. In order for the multipleSelectionStyle to be honored, the multipleMode property must be set to true.
- Modifying Items in the ListBox
  - Items can be added to the end of the list through the add(String), add(Object),addItems(Enumeration) and add(Object[]) methods. The addItem (String) and addItem(String, index) methods are deprecated and should not be used to add an item to the listBox. A null item can be added to the list if a display transform is applied that returns a non-null value.
  - An item can be inserted in the list through the add(String, int index) or add(Object, int index) methods. A null item can be inserted into the list if a display transform is applied that returns a non-null value. Specifying an index less than -1 or an index that is greater than (current item count - 1) will result in a java.lang.IndexOutOfBoundsException being thrown.
  - An item can be replaced in the list through the replaceItem(String, int index) or replaceItem(Object, int index) methods. Specifying an index of less than 0 or an index that is greater than (current item count - 1) will result in a java.lang.IndexOutOfBoundsException being thrown. An item can be replaced with a null if a display transform is applied that returns a non-null value.
  - An item can be removed from the list through the remove(String), remove(Object) or remove(int index) methods. Specifying an index of less than 0 or an index that is greater than (current item count - 1) will result in a java.lang.IndexOutOfBoundsException being thrown. Specifying an item that is not in the list will result in a java.lang.IllegalArgumentException(); to be thrown.
- Selecting/Deselecting Items in the List
- Items in the list can be selected through the following methods:
  - selectAll()
  - select(int index)
  - setSelectedIndex(int)
  - setSelectedIndexes(int[])
  - setSelectedItem(String)
  - setSelectedItem(Object)
  - setText(String)
  - setSelectedItems(String[])
  - setSelectedItems(Object[])
- Specifying an item that is not in the list will deselect the current selected item.
- If the multipleMode property is false, specifying select(-1) will cause any selected item in the listBox to be deselected. If the multipleMode property is set to true, specifying select(-1) will select all items in the list.
- Items in the list can be deselected through the following methods:
  - deselect(int)
  - deselectAll()
- MultipleMode Property and Selected Items
- If the multipleMode property is set to true, and more than one item is selected, then getSelectedItem() will return null and getSelectedIndex() will return -1.
- Performance Concerns
- Performing time-intensive operations (such as deleting items) in some of the event handlers (actionPerformed, itemStateChanged ) may result in a deadlock situation. In order to minimize the potential for a deadlock situation, you can disable the listbox (listBox.setEnabled(false)) in your event-handler code before the time-intensive operation and then enable (listBox.setEnabled(true)) the listBox afterwards.

- When adding many items to the listBox (300 or more as an approximation), it is recommended that the addItems(Enumeration) or addItems(Object[]) methods be used in lieu of adding individual items through the add(String) method in order to significantly reduce the amount of time for populating the listBox.

  See Also:
    Serialized Form

  Field Summary
  `static int` | `EXTENDED_SELECT`
  `static java.lang.String` | `RB_KEY`
  `static int` | `STANDARD_AWT`

  Constructor Summary
  `ListBox()` Default Constructor
  `ListBox(int rows)` Create a new ListBox with the specified number of rows
  `ListBox(int rows, boolean multipleMode)` Create a new ListBox with the specified number of rows and a boolean stating whether multiple selections are allowed

  Method Summary
  `void` | `add(java.lang.Object item)` Adds an item to the end of the list if the attached model supports addition of items.
  `void` | `add(java.lang.Object[] items)` Adds items to the end of the list if the attached model supports addition of items.
  `void` | `add(java.lang.Object item, int index)` Adds an item at the specified location if the attached model supports addition of items.
  `void` | `add(java.lang.String item)` Adds an item to the end of the list if the attached model supports addition of items.
  `void` | `add(java.lang.String item, int index)` Adds an item at the specified location if the attached model supports addition of items.
  `void` | `addItem(java.lang.String item)` Deprecated.
  `void` | `addItem(java.lang.String item, int index)` Deprecated.
  `void` | `addItems(java.util.Enumeration items)` Adds items to the end of the list if the attached model supports addition of items.
  `void` | `attachModel(com.sas.ModelInterface model)` Attaches a model to the component.
  `java.lang.Object` | `clone()` Clones the component
  `void` | `contentsChanged(com.sas.collection.ContentsChangedEvent evt)` Called when the contents of the model have changed.
  `void` | `deselect(int index)` Deselects the item at the specified index
  `void` | `deselectAll()` Deselects all items currently selected in the ListBox
  `void` | `detachModel(com.sas.ModelInterface model)` Detaches the current model and attaches the default model if the model is set to null
  `int` | `findItemByPrefix(java.lang.String prefix, int index)` Finds an item in the listbox starting with the specified prefix and location
  `static int` | `getDefaultHeight()` Returns the default height for instances of this class
  `static int` | `getDefaultWidth()` Returns the default width for instances of this class
  `com.sas.util.transforms.TransformInterface` | `getDisplayTransform()` Returns the display transform.
  `static com.sas.beans.ExtendedBeanInfo` | `getExtendedBeanInfo()` Returns the ExtendedBeanInfo for this class.
  `java.lang.String[]` | `getInitialItems()` Returns the initial items (an empty string array is returned if there are no initial items)
  `com.sas.util.transforms.TransformInterface` | `getInputTransform()` Returns the input transform.
  `int` | `getMultipleSelectionStyle()` Returns the multipleSelectionStyle.
  `com.sas.util.transforms.TransformInterface` | `getOutputTransform()` Returns the output transform.
  `java.util.Vector` | `getRequiredInterfaces()` Returns the required interfaces Vector for this component.
  `int[]` | `getSelectedIndexes()` Returns the selected indexes.
  `java.lang.String[]` | `getSelectedItems()` Returns the selected items.
  `java.lang.Object[]` | `getSelectedObjects()` Returns the selected objects.
  `java.lang.String` | `getSelectionPrefix()` Returns the selectionPrefix value.
  `java.lang.String` | `getText()` Returns the selected item.
  `int` | `getVisibleRows()` Returns the number of visible rows
  `void` | `initialize()` Preserve the value of the selectedIndex
  `void` | `initializeComponent()` Adds default items to the default model if in a design-time environment.
  `boolean` | `isDefaultModelAttached()` Returns whether the default model is attached.
  `boolean` | `isKeyboardSelectable()` Returns the value of the keyboardSelectable property.
  `boolean` | `isSelectionsOrdered()` Returns the value of the selectionsOrdered property.
  `void` | `paint(java.awt.Graphics g)` Paints the component.
  `protected void` | `processItemEvent(java.awt.event.ItemEvent e)` Processes item events occurring on this component.Subclasses should always call super so that events are delivered to any ItemListeners.
  `protected void` | `processKeyEvent(java.awt.event.KeyEvent e)` Processes key events occurring on this component.
  `void` | `refresh()` Clears current items and adds items obtained from the attached model
  `void` | `refresh(com.sas.ModelInterface model)` Clears current items and add items obtained from the attached model
  `void` | `remove(int position)` Removes an item at the specified position if the attached model supports removal of items.
  `void` | `remove(java.lang.Object item)` Removes the first occurrence of item if the attached model supports removal of items.
  `void` | `remove(java.lang.String item)` Removes the first occurrence of item if the attached model supports removal of items.
  `void` | `removeAll()` Removes all items from the ListBox
  `void` | `replaceItem(java.lang.Object newvalue, int index)` Replaces an item if the attached model supports replacement of items.
  `void` | `replaceItem(java.lang.String newvalue, int index)` Replaces an item if the attached model supports replacement of items.
  `void` | `select(int index)` Selects the item corresponding to the specified index
  `void` | `selectAll()` Selects all items
  `static void` | `setDefaultHeight(int newDefaultHeight)` Sets the default height of the component.
  `void` | `setDefaultValues()` Sets the initial values to the default values.
  `static void` | `setDefaultWidth(int newDefaultWidth)` Sets the default width of the component.
  `void` | `setDisplayTransform(com.sas.util.transforms.TransformInterface transform)` Sets the display transform.
  `void` | `setFont(java.awt.Font font)` Sets the font to be used by the component for displaying text.
  `void` | `setInitialItems(java.lang.String[] items)` Sets the initialItems on the ListBox.
  `void` | `setInputTransform(com.sas.util.transforms.TransformInterface transform)` Sets the input Transform.
  `void` | `setItems(java.lang.Object[] items)` Sets the items in the ListBox.
  `void` | `setItems(java.lang.String[] items)` Sets the items in the ListBox.
  `void` | `setKeyboardSelectable(boolean state)` Sets the value of the keyboardSelectable property.
  `void` | `setMultipleMode(boolean state)` Sets whether the ListBox allows multiple selections.
  `void` | `setMultipleSelectionStyle(int style)` Sets the multipleSelectionStyle(STANDARD_AWT or EXTENDED_SELECT).
  `void` | `setOutputTransform(com.sas.util.transforms.TransformInterface transform)` Sets the output Transform.
  `void` | `setSelectedIndex(int index)` Selects the item corresponding to the specified index
  `void` | `setSelectedIndexes(int[] indexes)` Selects the items corresponding to the specified indexes
  `void` | `setSelectedItem(java.lang.Object text)` Sets the selected item to the specified object.
  `void` | `setSelectedItem(java.lang.String text)` Sets the selected item to the specified string.
  `void` | `setSelectedItems(java.lang.Object[] items)` Sets the selected items to the specified objects.
  `void` | `setSelectedItems(java.lang.String[] items)` Sets the selected items to the specified strings.
  `void` | `setSelectionPrefix(java.lang.String prefix)` Sets the selection prefix.
  `void` | `setSelectionsOrdered(boolean value)` Sets the value of the selectionsOrdered property.
  `void` | `setText(java.lang.String text)` Sets the selected item.
  `void` | `setVisibleRows(int rows)` Sets the number of visible rows Setting the number of visible rows to a value less than 0 will be ignored.

  Methods inherited from class com.sas.awt.ListBoxVisualComponent
  `addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachView, computePreferredSize, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getMinimumSize, getModelInterface, getPreferredSize, getPrePainter, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, propertyChange, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setBounds, setComponentDescription, setComponentSupportInfo, setEnabled, setFocus, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, setModelInterface, setPreferredSize, setPrePainter, setRequiredInterfaces, setTransparent, setVerticalPosition, setViewInterfaceSupportInfo, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, update, validateObject`

  Field Detail

  ### RB_KEY

      public static final java.lang.String RB_KEY

  See Also:
    Constant Field Values

  ### STANDARD_AWT

      public static final int STANDARD_AWT

  See Also:
    Constant Field Values

  ### EXTENDED_SELECT

      public static final int EXTENDED_SELECT

  See Also:
    Constant Field Values

  Constructor Detail

  ### ListBox

      public ListBox()

    Default Constructor

  ### ListBox

      public ListBox(int rows)

    Create a new ListBox with the specified number of rows

    Parameters:
      `rows` - number of rows

  ### ListBox

      public ListBox(int rows,
                     boolean multipleMode)

    Create a new ListBox with the specified number of rows and a boolean stating whether multiple selections are allowed

    Parameters:
      `rows` - number of rows
      `multipleMode` - boolean indicating whether multiple selections are allowed

  Method Detail

  ### getDefaultWidth

      public static int getDefaultWidth()

    Returns the default width for instances of this class

    Returns:
      the default width in pixels
    See Also:
      `setDefaultWidth(int)`

  ### setDefaultWidth

      public static void setDefaultWidth(int newDefaultWidth)

    Sets the default width of the component. The default width will be used by webAF when creating this component.

    Parameters:
      `newDefaultWidth` - the new default width in pixels
    See Also:
      `getDefaultWidth()`

  ### getDefaultHeight

      public static int getDefaultHeight()

    Returns the default height for instances of this class

    Returns:
      the default height in pixels
    See Also:
      `setDefaultHeight(int)`

  ### setDefaultHeight

      public static void setDefaultHeight(int newDefaultHeight)

    Sets the default height of the component. The default height will be used by webAF when creating this component.

    Parameters:
      `newDefaultHeight` - the new default height in pixels
    See Also:
      `getDefaultHeight()`

  ### getExtendedBeanInfo

      public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

    Returns the ExtendedBeanInfo for this class.

    Returns:
      ExtendedBeanInfo for this class

  ### addItems

      public void addItems(java.util.Enumeration items)

    Adds items to the end of the list if the attached model supports addition of items.

    Parameters:
      `items` - items to be added

  ### add

      public void add(java.lang.Object item)

    Adds an item to the end of the list if the attached model supports addition of items.

    Parameters:
      `item` - item to be added

  ### add

      public void add(java.lang.Object item,
                      int index)

    Adds an item at the specified location if the attached model supports addition of items.

    Parameters:
      `item` - item to be added
      `index` - location for adding the item

  ### add

      public void add(java.lang.Object[] items)

    Adds items to the end of the list if the attached model supports addition of items.

    Parameters:
      `items` - items to be added

  ### add

      public void add(java.lang.String item)

    Adds an item to the end of the list if the attached model supports addition of items.

    Overrides:
      `add` in class `java.awt.List`
    Parameters:
      `item` - item to be added

  ### add

      public void add(java.lang.String item,
                      int index)

    Adds an item at the specified location if the attached model supports addition of items.

    Overrides:
      `add` in class `java.awt.List`
    Parameters:
      `item` - item to be added
      `index` - location for adding the item

  ### addItem

      public void addItem(java.lang.String item)

    Deprecated.

    Overrides:
      `addItem` in class `java.awt.List`

  ### addItem

      public void addItem(java.lang.String item,
                          int index)

    Deprecated.

    Overrides:
      `addItem` in class `java.awt.List`

  ### attachModel

      public void attachModel(com.sas.ModelInterface model)

    Attaches a model to the component. Listens for PropertyChangeEvents from the model.

    Specified by:
      `attachModel` in interface `com.sas.ViewInterface`
    Overrides:
      `attachModel` in class `ListBoxVisualComponent`
    Parameters:
      `model` - model to attach
    See Also:
      `ViewInterface.attachModel(com.sas.ModelInterface)`

  ### clone

      public java.lang.Object clone()
                             throws java.lang.CloneNotSupportedException

    Clones the component

    Specified by:
      `clone` in interface `com.sas.PublicClonable`
    Overrides:
      `clone` in class `ListBoxVisualComponent`
    Returns:
      new instance of the ListBox
    Throws:
      `java.lang.CloneNotSupportedException` - if the model attached to the component being cloned will not allow the clone to attach.

  ### contentsChanged

      public void contentsChanged(com.sas.collection.ContentsChangedEvent evt)

    Called when the contents of the model have changed.

    Specified by:
      `contentsChanged` in interface `com.sas.collection.ContentsChangedListener`
    Parameters:
      `evt` - ContentsChangedEvent from the model

  ### deselect

      public void deselect(int index)

    Deselects the item at the specified index

    Overrides:
      `deselect` in class `java.awt.List`
    Parameters:
      `index` - postion of the item to deselect

  ### deselectAll

      public void deselectAll()

    Deselects all items currently selected in the ListBox

  ### detachModel

      public void detachModel(com.sas.ModelInterface model)

    Detaches the current model and attaches the default model if the model is set to null

    Specified by:
      `detachModel` in interface `com.sas.ViewInterface`
    Overrides:
      `detachModel` in class `ListBoxVisualComponent`
    Parameters:
      `model` - Model to detach
    See Also:
      `ViewInterface.detachModel(com.sas.ModelInterface)`

  ### findItemByPrefix

      public int findItemByPrefix(java.lang.String prefix,
                                  int index)

    Finds an item in the listbox starting with the specified prefix and location

    Parameters:
      `prefix` - prefix
      `index` - starting location
    Returns:
      location of the specified prefix (-1 if prefix is not found)

  ### getDisplayTransform

      public com.sas.util.transforms.TransformInterface getDisplayTransform()

    Returns the display transform.

    Returns:
      the display transform
    See Also:
      `setDisplayTransform(com.sas.util.transforms.TransformInterface)`

  ### getInitialItems

      public java.lang.String[] getInitialItems()

    Returns the initial items (an empty string array is returned if there are no initial items)

    Returns:
      initial items
    See Also:
      `setInitialItems(java.lang.String[])`

  ### getInputTransform

      public com.sas.util.transforms.TransformInterface getInputTransform()

    Returns the input transform.

    Returns:
      the input transform
    See Also:
      `setInputTransform(com.sas.util.transforms.TransformInterface)`

  ### getMultipleSelectionStyle

      public int getMultipleSelectionStyle()

    Returns the multipleSelectionStyle.

    Returns:
      multipleSelectionStyle
    See Also:
      `setMultipleSelectionStyle(int)`

  ### getOutputTransform

      public com.sas.util.transforms.TransformInterface getOutputTransform()

    Returns the output transform.

    Returns:
      the output transform
    See Also:
      `setOutputTransform(com.sas.util.transforms.TransformInterface)`

  ### getRequiredInterfaces

      public java.util.Vector getRequiredInterfaces()

    Returns the required interfaces Vector for this component.

    Specified by:
      `getRequiredInterfaces` in interface `com.sas.ViewInterface`
    Overrides:
      `getRequiredInterfaces` in class `ListBoxVisualComponent`
    Returns:
      the required interfaces Vector for this component.
    See Also:
      `ViewInterface.getRequiredInterfaces()`

  ### getSelectedIndexes

      public int[] getSelectedIndexes()

    Returns the selected indexes. An empty int array is returned if there are no selected indexes.

    Overrides:
      `getSelectedIndexes` in class `java.awt.List`
    Returns:
      an array containing the selectedIndexes
    See Also:
      `setSelectedIndexes(int[])`

  ### getSelectedItems

      public java.lang.String[] getSelectedItems()

    Returns the selected items. An empty String array is returned if there are no selected items.

    Overrides:
      `getSelectedItems` in class `java.awt.List`
    Returns:
      an array containing the selectedItems
    See Also:
      `setSelectedItems(java.lang.Object[])`

  ### getSelectedObjects

      public java.lang.Object[] getSelectedObjects()

    Returns the selected objects. This method is overridden in order to actually contain objects within the object array(AWT returns an object array containing string items). An empty object array is returned if there are no selectedObjects.

    Specified by:
      `getSelectedObjects` in interface `java.awt.ItemSelectable`
    Overrides:
      `getSelectedObjects` in class `java.awt.List`
    Returns:
      object array that contains the objects selected

  ### getSelectionPrefix

      public java.lang.String getSelectionPrefix()

    Returns the selectionPrefix value. The selection prefix is a "search string" which is used by the findItemByPrefix method.

    Returns:
      selectionPrefix
    See Also:
      `findItemByPrefix(java.lang.String, int)`, `setSelectionPrefix(java.lang.String)`

  ### getText

      public java.lang.String getText()

    Returns the selected item. This method is an alias for getSelectedItem().

    Specified by:
      `getText` in interface `com.sas.lang.StringDataInterface`
    Returns:
      selectedItem
    See Also:
      `setText(java.lang.String)`

  ### getVisibleRows

      public int getVisibleRows()

    Returns the number of visible rows

    Returns:
      number of visible rows
    See Also:
      `getVisibleRows()`

  ### isDefaultModelAttached

      public boolean isDefaultModelAttached()

    Returns whether the default model is attached.

    Specified by:
      `isDefaultModelAttached` in interface `com.sas.ViewDefaultModelInterface`
    Returns:
      whether the default model is attached.

  ### isKeyboardSelectable

      public boolean isKeyboardSelectable()

    Returns the value of the keyboardSelectable property. The keyboardSelectable property indicates whether an event is sent whenever a character is typed in the ListBox.

    Returns:
      value of the keyboardSelectable property
    See Also:
      `setKeyboardSelectable(boolean)`

  ### initialize

      public void initialize()

    Preserve the value of the selectedIndex

    Specified by:
      `initialize` in interface `com.sas.ComponentInterface`
    Overrides:
      `initialize` in class `ListBoxVisualComponent`
    See Also:
      `ComponentInterface.initialize()`

  ### initializeComponent

      public void initializeComponent()

    Adds default items to the default model if in a design-time environment.

    Specified by:
      `initializeComponent` in interface `com.sas.ComponentInterface`
    Overrides:
      `initializeComponent` in class `ListBoxVisualComponent`
    See Also:
      `ComponentInterface.initializeComponent()`

  ### isSelectionsOrdered

      public boolean isSelectionsOrdered()

    Returns the value of the selectionsOrdered property. The selectionsOrderedproperty indicates whether the selectedItems and selectedIndexes should be returned in the order in which the selection occurred.

    Returns:
      value of the selectionsOrdered property
    See Also:
      `setSelectionsOrdered(boolean)`

  ### paint

      public void paint(java.awt.Graphics g)

    Paints the component.

    Overrides:
      `paint` in class `ListBoxVisualComponent`
    Parameters:
      `g` - the specified Graphics window
    See Also:
      `VisualInterfaceSupport.paint(com.sas.ComponentInterface, com.sas.awt.VisualInterface, java.awt.Component, java.awt.Graphics)`

  ### processItemEvent

      protected void processItemEvent(java.awt.event.ItemEvent e)

    Processes item events occurring on this component.Subclasses should always call super so that events are delivered to any ItemListeners.

    Overrides:
      `processItemEvent` in class `java.awt.List`
    Parameters:
      `e` - event to be handled

  ### processKeyEvent

      protected void processKeyEvent(java.awt.event.KeyEvent e)

    Processes key events occurring on this component. Subclasses should always call super so that events are delivered to any KeyListeners. but can still override this behavior by consuming the event.

    Overrides:
      `processKeyEvent` in class `java.awt.Component`
    Parameters:
      `e` - the key event.
    See Also:
      `KeyListener`, `InputEvent.consume()`

  ### refresh

      public void refresh()

    Clears current items and adds items obtained from the attached model

  ### refresh

      public void refresh(com.sas.ModelInterface model)

    Clears current items and add items obtained from the attached model

    Specified by:
      `refresh` in interface `com.sas.ViewInterface`
    Overrides:
      `refresh` in class `ListBoxVisualComponent`
    Parameters:
      `model` - attached model
    See Also:
      `ViewInterface.refresh(com.sas.ModelInterface)`

  ### remove

      public void remove(int position)

    Removes an item at the specified position if the attached model supports removal of items.

    Overrides:
      `remove` in class `java.awt.List`
    Parameters:
      `position` - index of the item to be removed

  ### remove

      public void remove(java.lang.Object item)

    Removes the first occurrence of item if the attached model supports removal of items.

    Parameters:
      `item` - item to be removed
    Throws:
      `java.lang.IllegalArgumentException();` - if item is not found

  ### remove

      public void remove(java.lang.String item)

    Removes the first occurrence of item if the attached model supports removal of items.

    Overrides:
      `remove` in class `java.awt.List`
    Parameters:
      `item` - item to be removed

  ### removeAll

      public void removeAll()

    Removes all items from the ListBox

    Overrides:
      `removeAll` in class `java.awt.List`

  ### replaceItem

      public void replaceItem(java.lang.Object newvalue,
                              int index)

    Replaces an item if the attached model supports replacement of items.

    Parameters:
      `newvalue` - replacement text
      `index` - index of the item to be replaced

  ### replaceItem

      public void replaceItem(java.lang.String newvalue,
                              int index)

    Replaces an item if the attached model supports replacement of items.

    Overrides:
      `replaceItem` in class `java.awt.List`
    Parameters:
      `newvalue` - replacement text
      `index` - index of the item to be replaced

  ### select

      public void select(int index)

    Selects the item corresponding to the specified index

    Overrides:
      `select` in class `java.awt.List`
    Parameters:
      `index` - the selected item position

  ### selectAll

      public void selectAll()

    Selects all items

  ### setDefaultValues

      public void setDefaultValues()

    Sets the initial values to the default values. This method is called by the Component constructors. The setDefaultValues method of each class is responsible for setting its own initial values.

    Specified by:
      `setDefaultValues` in interface `VisualInterface`
    Specified by:
      `setDefaultValues` in interface `com.sas.ComponentInterface`
    Overrides:
      `setDefaultValues` in class `ListBoxVisualComponent`
    See Also:
      `ComponentInterface.setDefaultValues()`

  ### setDisplayTransform

      public void setDisplayTransform(com.sas.util.transforms.TransformInterface transform)

    Sets the display transform. The display transform is used to transform the data prior to it being displayed.

    Parameters:
      `transform` - the new value for the displayTransform property
    See Also:
      `getDisplayTransform()`

  ### setFont

      public void setFont(java.awt.Font font)

    Sets the font to be used by the component for displaying text.

    Specified by:
      `setFont` in interface `VisualInterface`
    Overrides:
      `setFont` in class `ListBoxVisualComponent`
    Parameters:
      `font` - font
    See Also:
      `Component.setFont(java.awt.Font)`, `ListBoxVisualComponent.getFont()`

  ### setInputTransform

      public void setInputTransform(com.sas.util.transforms.TransformInterface transform)

    Sets the input Transform. The inputTransform is used to transform the input to methods of the ListBox to the objects that are in the model.

    Parameters:
      `the` - new value for the inputTransform property
    See Also:
      `getInputTransform()`

  ### setInitialItems

      public void setInitialItems(java.lang.String[] items)

    Sets the initialItems on the ListBox. This sets the items on the defaultModel and will attach the defaultModel if it is not already attached. The items will all be transformed using the inputTransform before being added to the model.

    Parameters:
      `items` - items to add to the defaultModel
    See Also:
      `getInitialItems()`

  ### setItems

      public void setItems(java.lang.Object[] items)

    Sets the items in the ListBox.

    Parameters:
      `items` - an array of elements to set the ListBox with

  ### setItems

      public void setItems(java.lang.String[] items)

    Sets the items in the ListBox.

    Parameters:
      `items` - an array of elements to set the ListBox with

  ### setKeyboardSelectable

      public void setKeyboardSelectable(boolean state)

    Sets the value of the keyboardSelectable property. The keyboardSelectable property indicates whether an event is sent whenever a character is typed in the ListBox. In order to be set to true, the multipleMode property must be false. If any of the items in the Listbox begin with the character typed in the ListBox, the item will be selected.

    Parameters:
      `state` - boolean value

  ### setMultipleMode

      public void setMultipleMode(boolean state)

    Sets whether the ListBox allows multiple selections.

    Overrides:
      `setMultipleMode` in class `java.awt.List`
    Parameters:
      `state` - if true then multiple selections are allowed; otherwise, only one item can be selected at a time.
    See Also:
      `List.isMultipleMode()`

  ### setMultipleSelectionStyle

      public void setMultipleSelectionStyle(int style)

    Sets the multipleSelectionStyle(STANDARD_AWT or EXTENDED_SELECT). Specifying any other value will result in a java.lang.IllegalArgumentException(); to be thrown. The multipleMode property must be set to true in order for the multipleSelectionStyle to be honored.

    Parameters:
      `style` - multipleSelectionStyle (STANDARD_AWT (0) or EXTENDED_SELECT (1)).
    Throws:
      `java.lang.IllegalArgumentException();`

  ### setOutputTransform

      public void setOutputTransform(com.sas.util.transforms.TransformInterface transform)

    Sets the output Transform. The outputTransform is used to transform the output from methods of the ListBox from the objects that are in the model.

    Parameters:
      `transform` - the new value for the outputTransform property
    See Also:
      `getOutputTransform()`

  ### setSelectedIndex

      public void setSelectedIndex(int index)

    Selects the item corresponding to the specified index

    Parameters:
      `index` - position of the selected item

  ### setSelectedIndexes

      public void setSelectedIndexes(int[] indexes)

    Selects the items corresponding to the specified indexes

    Parameters:
      `indexes` - positions of the selected items

  ### setSelectedItem

      public void setSelectedItem(java.lang.Object text)

    Sets the selected item to the specified object. If more than one item matches the specified object, the one with the smallest index is selected.

    Parameters:
      `text` - the string to select

  ### setSelectedItem

      public void setSelectedItem(java.lang.String text)

    Sets the selected item to the specified string. If more than one item matches the specified string, the one with the smallest index is selected.

    Parameters:
      `text` - the string to select

  ### setSelectedItems

      public void setSelectedItems(java.lang.Object[] items)

    Sets the selected items to the specified objects.

    Parameters:
      `items` - an array of Objects to select

  ### setSelectedItems

      public void setSelectedItems(java.lang.String[] items)

    Sets the selected items to the specified strings.

    Parameters:
      `items` - an array of Strings to select

  ### setSelectionPrefix

      public void setSelectionPrefix(java.lang.String prefix)

    Sets the selection prefix. The selection prefix is a "search string" which is used by the findItemByPrefix method.

    Parameters:
      `prefix` - selection prefix
    See Also:
      `findItemByPrefix(java.lang.String, int)`, `getSelectionPrefix()`

  ### setSelectionsOrdered

      public void setSelectionsOrdered(boolean value)

    Sets the value of the selectionsOrdered property. The selectionsOrderedproperty indicates whether the selectedItems and selectedIndexes should be returned in the order in which the selection occurred. The default behavior is to return the selections in ascending numeric order.

    Parameters:
      `value` - of the selectionsOrdered property
    See Also:
      `isSelectionsOrdered()`

  ### setText

      public void setText(java.lang.String text)

    Sets the selected item. This method is an alias for setSelectedItem(String).

    Specified by:
      `setText` in interface `com.sas.lang.StringDataInterface`
    Parameters:
      `selected` - item

  ### setVisibleRows

      public void setVisibleRows(int rows)

    Sets the number of visible rows Setting the number of visible rows to a value less than 0 will be ignored.

    Parameters:
      `rows` - number of visible rows
    See Also:
      `getVisibleRows()`

  All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
  |  | Components |
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

  Copyright © 2009 SAS Institute Inc. All Rights Reserved.