public class PsList
extends java.awt.List
Constructor and Description |
---|
PsList()
Creates a new scrolling list.
|
PsList(int rows)
Creates a new scrolling list initialized with the specified
number of visible lines.
|
PsList(int rows,
boolean multipleMode)
Creates a new scrolling list initialized to display the specified
number of rows.
|
Modifier and Type | Method and Description |
---|---|
void |
addItemListener(java.awt.event.ItemListener l)
Adds the specified item listener to receive item events from
this list.
|
void |
removeItemListener(java.awt.event.ItemListener l)
Removes the specified item listener so that it no longer
receives item events from this list.
|
void |
select(int index)
Selects the item at the specified index in the scrolling list.
|
add, add, addActionListener, addItem, addItem, addNotify, allowsMultipleSelections, clear, countItems, delItem, delItems, deselect, getAccessibleContext, getActionListeners, getItem, getItemCount, getItemListeners, getItems, getListeners, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, getRows, getSelectedIndex, getSelectedIndexes, getSelectedItem, getSelectedItems, getSelectedObjects, getVisibleIndex, isIndexSelected, isMultipleMode, isSelected, makeVisible, minimumSize, minimumSize, preferredSize, preferredSize, remove, remove, removeActionListener, removeAll, removeNotify, replaceItem, setMultipleMode, setMultipleSelections
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
public PsList()
List(0, false)
. Also note that the number of visible
lines in the list cannot be changed after it has been created.
returns true.public PsList(int rows)
List(rows, false)
. Also note that the number
of visible rows in the list cannot be changed after it has
been created.rows
- the number of items to show.public PsList(int rows, boolean multipleMode)
multipleMode
is
true
, then the user can select multiple items from
the list. If it is false
, only one item at a time
can be selected.rows
- the number of items to show.multipleMode
- if true
,
then multiple selections are allowed;
otherwise, only one item can be selected at a time.public void select(int index)
Note that passing out of range parameters is invalid, and will result in unspecified behavior.
Note that this method should be primarily used to
initially select an item in this component.
Programmatically calling this method will not trigger
an ItemEvent
. The only way to trigger an
ItemEvent
is by user interaction.
select
in class java.awt.List
index
- the position of the item to selectList.getSelectedItem()
,
List.deselect(int)
,
List.isIndexSelected(int)
public void addItemListener(java.awt.event.ItemListener l)
select
or deselect
.
If listener l
is null
,
no exception is thrown and no action is performed.
Refer to AWT Threading Issues for details on AWT's threading model.
addItemListener
in interface java.awt.ItemSelectable
addItemListener
in class java.awt.List
l
- the item listenerremoveItemListener(java.awt.event.ItemListener)
,
List.getItemListeners()
,
select(int)
,
List.deselect(int)
,
ItemEvent
,
ItemListener
public void removeItemListener(java.awt.event.ItemListener l)
l
is null
,
no exception is thrown and no action is performed.
Refer to AWT Threading Issues for details on AWT's threading model.
removeItemListener
in interface java.awt.ItemSelectable
removeItemListener
in class java.awt.List
l
- the item listeneraddItemListener(java.awt.event.ItemListener)
,
List.getItemListeners()
,
ItemEvent
,
ItemListener
"