All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.List
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.List
- public class List
- extends Component
- implements ItemSelectable
A scrolling list of text items.
-
List()
- Creates a new scrolling list initialized with no visible Lines
or multiple selections.
-
List(int)
- Creates a new scrolling list initialized with the specified
number of visible lines and a boolean stating whether multiple
selections are allowed or not.
-
List(int, boolean)
- Creates a new scrolling list initialized with the specified
number of visible lines and a boolean stating whether multiple
selections are allowed or not.
-
add(String)
- Adds the specified item to the end of scrolling list.
-
add(String, int)
- Adds the specified item to the scrolling list at the specified
position.
-
addActionListener(ActionListener)
- Adds the specified action listener to receive action events
from this list.
-
addItem(String)
- Adds the specified item to the end of scrolling list.
-
addItem(String, int)
- Adds the specified item to the scrolling list at the specified
position.
-
addItemListener(ItemListener)
- Adds the specified item listener to recieve item events from
this list.
-
addNotify()
- Creates the peer for the list.
-
allowsMultipleSelections()
-
Deprecated.
-
clear()
-
Deprecated.
-
countItems()
-
Deprecated.
-
delItem(int)
- Removes an item from the list.
-
delItems(int, int)
-
Deprecated.
-
deselect(int)
- Deselects the item at the specified index.
-
getItem(int)
- Gets the item associated with the specified index.
-
getItemCount()
- Returns the number of items in the list.
-
getItems()
- Returns the items in the list.
-
getMinimumSize()
- Returns the minimum dimensions needed for the list.
-
getMinimumSize(int)
- Returns the minimum dimensions needed for the amount of rows in the
list.
-
getPreferredSize()
- Returns the preferred dimensions needed for the list.
-
getPreferredSize(int)
- Returns the preferred dimensions needed for the list with the specified
amount of rows.
-
getRows()
- Returns the number of visible lines in this list.
-
getSelectedIndex()
- Get the selected item on the list or -1 if no item is selected.
-
getSelectedIndexes()
- Returns the selected indexes on the list.
-
getSelectedItem()
- Returns the selected item on the list or null if no item is selected.
-
getSelectedItems()
- Returns the selected items on the list in an array of Strings.
-
getSelectedObjects()
- Returns the selected items on the list in an array of Objects.
-
getVisibleIndex()
- Gets the index of the item that was last made visible by the method
makeVisible.
-
isIndexSelected(int)
- Returns true if the item at the specified index has been selected;
false otherwise.
-
isMultipleMode()
- Returns true if this list allows multiple selections.
-
isSelected(int)
-
Deprecated.
-
makeVisible(int)
- Forces the item at the specified index to be visible.
-
minimumSize()
-
Deprecated.
-
minimumSize(int)
-
Deprecated.
-
paramString()
- Returns the parameter String of this list.
-
preferredSize()
-
Deprecated.
-
preferredSize(int)
-
Deprecated.
-
processActionEvent(ActionEvent)
-
Processes action events occurring on this component by
dispatching them to any registered ActionListener objects.
-
processEvent(AWTEvent)
- Processes events on this list.
-
processItemEvent(ItemEvent)
-
Processes item events occurring on this list by
dispatching them to any registered ItemListener objects.
-
remove(int)
- Removes an item from the list.
-
remove(String)
- Remove the first occurrence of item from the list.
-
removeActionListener(ActionListener)
- Removes the specified action listener so it no longer receives
action events from this list.
-
removeAll()
- Removes all items from the list.
-
removeItemListener(ItemListener)
- Removes the specified item listener so it no longer receives
item events from this list.
-
removeNotify()
- Removes the peer for this list.
-
replaceItem(String, int)
- Replaces the item at the given index.
-
select(int)
- Selects the item at the specified index.
-
setMultipleMode(boolean)
- Sets whether this list should allow multiple selections or not.
-
setMultipleSelections(boolean)
-
Deprecated.
List
method List() public
- Creates a new scrolling list initialized with no visible Lines
or multiple selections.
List
method List(rows=int) public
- Creates a new scrolling list initialized with the specified
number of visible lines and a boolean stating whether multiple
selections are allowed or not.
- Parameters:
- rows - the number of items to show.
- multipleMode - if true then multiple selections are allowed.
List
method List(rows=int, -
multipleMode=boolean) public
- Creates a new scrolling list initialized with the specified
number of visible lines and a boolean stating whether multiple
selections are allowed or not.
- Parameters:
- rows - the number of items to show.
- multipleMode - if true then multiple selections are allowed.
addNotify
method addNotify() public
- Creates the peer for the list. The peer allows us to modify the
list's appearance without changing its functionality.
- Overrides:
- addNotify in class Component
removeNotify
method removeNotify() public
- Removes the peer for this list. The peer allows us to modify the
list's appearance without changing its functionality.
- Overrides:
- removeNotify in class Component
getItemCount
method getItemCount() returns int public
- Returns the number of items in the list.
- See Also:
- getItem
countItems
method countItems() returns int public
- Note: countItems() is deprecated.
As of JDK version 1.1,
replaced by getItemCount().
getItem
method getItem(index=int) returns String public
- Gets the item associated with the specified index.
- Parameters:
- index - the position of the item
- See Also:
- getItemCount
getItems
method getItems() returns String[] public protect
- Returns the items in the list.
- See Also:
- select, deselect, isIndexSelected
add
method add(item=String) public
- Adds the specified item to the end of scrolling list.
- Parameters:
- item - the item to be added
addItem
method addItem(item=String) public
- Adds the specified item to the end of scrolling list.
- Parameters:
- item - the item to be added
add
method add(item=String, -
index=int) public protect
- Adds the specified item to the scrolling list at the specified
position.
- Parameters:
- item - the item to be added
- index - the position at which to put in the item. The
index is zero-based. If index is -1 then the item is added to
the end. If index is greater than the number of items in the
list, the item gets added at the end.
addItem
method addItem(item=String, -
index=int) public protect
- Adds the specified item to the scrolling list at the specified
position.
- Parameters:
- item - the item to be added
- index - the position at which to put in the item. The
index is zero-based. If index is -1 then the item is added to
the end. If index is greater than the number of items in the
list, the item gets added at the end.
replaceItem
method replaceItem(newValue=String, -
index=int) public protect
- Replaces the item at the given index.
- Parameters:
- newValue - the new value to replace the existing item
- index - the position of the item to replace
removeAll
method removeAll() public protect
- Removes all items from the list.
- See Also:
- remove, delItems
clear
method clear() public protect
- Note: clear() is deprecated.
As of JDK version 1.1,
replaced by removeAll().
remove
method remove(item=String) public protect
- Remove the first occurrence of item from the list.
- Parameters:
- item - the item to remove from the list
- Throws: IllegalArgumentException
- If the item doesn't exist in the list.
remove
method remove(position=int) public protect
- Removes an item from the list.
delItem
method delItem(position=int) public protect
- Removes an item from the list.
getSelectedIndex
method getSelectedIndex() returns int public protect
- Get the selected item on the list or -1 if no item is selected.
- See Also:
- select, deselect, isIndexSelected
getSelectedIndexes
method getSelectedIndexes() returns int[] public protect
- Returns the selected indexes on the list.
- See Also:
- select, deselect, isIndexSelected
getSelectedItem
method getSelectedItem() returns String public protect
- Returns the selected item on the list or null if no item is selected.
- See Also:
- select, deselect, isIndexSelected
getSelectedItems
method getSelectedItems() returns String[] public protect
- Returns the selected items on the list in an array of Strings.
- See Also:
- select, deselect, isIndexSelected
getSelectedObjects
method getSelectedObjects() returns Object[] public
- Returns the selected items on the list in an array of Objects.
- See Also:
- ItemSelectable
select
method select(index=int) public protect
- Selects the item at the specified index.
- Parameters:
- index - the position of the item to select
- See Also:
- getSelectedItem, deselect, isIndexSelected
deselect
method deselect(index=int) public protect
- Deselects the item at the specified index.
- Parameters:
- index - the position of the item to deselect
- See Also:
- select, getSelectedItem, isIndexSelected
isIndexSelected
method isIndexSelected(index=int) returns boolean public
- Returns true if the item at the specified index has been selected;
false otherwise.
- Parameters:
- index - the item to be checked
- See Also:
- select, deselect
isSelected
method isSelected(index=int) returns boolean public
- Note: isSelected() is deprecated.
As of JDK version 1.1,
replaced by isIndexSelected(int).
getRows
method getRows() returns int public
- Returns the number of visible lines in this list.
isMultipleMode
method isMultipleMode() returns boolean public
- Returns true if this list allows multiple selections.
- See Also:
- setMultipleMode
allowsMultipleSelections
method allowsMultipleSelections() returns boolean public
- Note: allowsMultipleSelections() is deprecated.
As of JDK version 1.1,
replaced by isMultipleMode().
setMultipleMode
method setMultipleMode(b=boolean) public protect
- Sets whether this list should allow multiple selections or not.
- Parameters:
- v - the boolean to allow multiple selections
- See Also:
- isMultipleMode
setMultipleSelections
method setMultipleSelections(b=boolean) public protect
- Note: setMultipleSelections() is deprecated.
As of JDK version 1.1,
replaced by setMultipleMode(boolean).
getVisibleIndex
method getVisibleIndex() returns int public
- Gets the index of the item that was last made visible by the method
makeVisible.
makeVisible
method makeVisible(index=int) public protect
- Forces the item at the specified index to be visible.
- Parameters:
- index - the position of the item
- See Also:
- getVisibleIndex
getPreferredSize
method getPreferredSize(rows=int) returns Dimension public
- Returns the preferred dimensions needed for the list with the specified
amount of rows.
- Parameters:
- rows - amount of rows in list.
preferredSize
method preferredSize(rows=int) returns Dimension public
- Note: preferredSize() is deprecated.
As of JDK version 1.1,
replaced by getPreferredSize(int).
getPreferredSize
method getPreferredSize() returns Dimension public
- Returns the preferred dimensions needed for the list.
- Returns:
- the preferred size with the specified number of rows if the
row size is greater than 0.
- Overrides:
- getPreferredSize in class Component
preferredSize
method preferredSize() returns Dimension public
- Note: preferredSize() is deprecated.
As of JDK version 1.1,
replaced by getPreferredSize().
- Overrides:
- preferredSize in class Component
getMinimumSize
method getMinimumSize(rows=int) returns Dimension public
- Returns the minimum dimensions needed for the amount of rows in the
list.
- Parameters:
- rows - minimum amount of rows in the list
minimumSize
method minimumSize(rows=int) returns Dimension public
- Note: minimumSize() is deprecated.
As of JDK version 1.1,
replaced by getMinimumSize(int).
getMinimumSize
method getMinimumSize() returns Dimension public
- Returns the minimum dimensions needed for the list.
- Returns:
- the preferred size with the specified number of rows if
the row size is greater than zero.
- Overrides:
- getMinimumSize in class Component
minimumSize
method minimumSize() returns Dimension public
- Note: minimumSize() is deprecated.
As of JDK version 1.1,
replaced by getMinimumSize().
- Overrides:
- minimumSize in class Component
addItemListener
method addItemListener(l=ItemListener) public
- Adds the specified item listener to recieve item events from
this list.
- Parameters:
- l - the item listener
removeItemListener
method removeItemListener(l=ItemListener) public
- Removes the specified item listener so it no longer receives
item events from this list.
- Parameters:
- l - the item listener
addActionListener
method addActionListener(l=ActionListener) public
- Adds the specified action listener to receive action events
from this list. Action events occur when a list item is
double-clicked.
- Parameters:
- l - the action listener
removeActionListener
method removeActionListener(l=ActionListener) public
- Removes the specified action listener so it no longer receives
action events from this list.
- Parameters:
- l - the action listener
processEvent
method processEvent(e=AWTEvent) Inheritable
- Processes events on this list. If the event is an ItemEvent,
it invokes the processItemEvent method, else if the event is an
ActionEvent, it invokes the processActionEvent method, else it
invokes the superclass's processEvent.
- Parameters:
- e - the event
- Overrides:
- processEvent in class Component
processItemEvent
method processItemEvent(e=ItemEvent) Inheritable
- Processes item events occurring on this list by
dispatching them to any registered ItemListener objects.
NOTE: This method will not be called unless item events
are enabled for this component; this happens when one of the
following occurs:
a) An ItemListener object is registered via addItemListener()
b) Item events are enabled via enableEvents()
- Parameters:
- e - the item event
- See Also:
- enableEvents
processActionEvent
method processActionEvent(e=ActionEvent) Inheritable
- Processes action events occurring on this component by
dispatching them to any registered ActionListener objects.
NOTE: This method will not be called unless action events
are enabled for this component; this happens when one of the
following occurs:
a) An ActionListener object is registered via addActionListener()
b) Action events are enabled via enableEvents()
- Parameters:
- e - the action event
- See Also:
- enableEvents
paramString
method paramString() returns String Inheritable
- Returns the parameter String of this list.
- Overrides:
- paramString in class Component
delItems
method delItems(start=int, -
end=int) public protect
- Note: delItems() is deprecated.
As of JDK version 1.1,
Not for public use in the future.
This method is expected to be retained only as a package
private method.
All Packages Class Hierarchy This Package Previous Next Index