|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.List
A scrolling list of text items.
Field Summary |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
List()
Creates a new scrolling list initialized with no visible Lines or multiple selections. |
|
List(int rows,
boolean multipleSelections)
Creates a new scrolling list initialized with the specified number of visible lines and a boolean stating whether multiple selections are allowed or not. |
Method Summary | |
void |
addItem(String item)
Adds the specified item to the end of scrolling list. |
void |
addItem(String item,
int index)
Adds the specified item to the end of scrolling list. |
void |
addNotify()
Creates the peer for the list. |
boolean |
allowsMultipleSelections()
Returns true if this list allows multiple selections. |
void |
clear()
Clears the list. |
int |
countItems()
Returns the number of items in the list. |
void |
delItem(int position)
Delete an item from the list. |
void |
delItems(int start,
int end)
Delete multiple items from the list. |
void |
deselect(int index)
Deselects the item at the specified index. |
String |
getItem(int index)
Gets the item associated with the specified index. |
int |
getRows()
Returns the number of visible lines in this list. |
int |
getSelectedIndex()
Get the selected item on the list or -1 if no item is selected. |
int[] |
getSelectedIndexes()
Returns the selected indexes on the list. |
String |
getSelectedItem()
Returns the selected item on the list or null if no item is selected. |
String[] |
getSelectedItems()
Returns the selected items on the list. |
int |
getVisibleIndex()
Gets the index of the item that was last made visible by the method makeVisible. |
boolean |
isSelected(int index)
Returns true if the item at the specified index has been selected; false otherwise. |
void |
makeVisible(int index)
Forces the item at the specified index to be visible. |
Dimension |
minimumSize()
Returns the minimum dimensions needed for the list. |
Dimension |
minimumSize(int rows)
Returns the minimum dimensions needed for the amount of rows in the list. |
protected String |
paramString()
Returns the parameter String of this list. |
Dimension |
preferredSize()
Returns the preferred dimensions needed for the list. |
Dimension |
preferredSize(int rows)
Returns the preferred dimensions needed for the list with the specified amount of rows. |
void |
removeNotify()
Removes the peer for this list. |
void |
replaceItem(String newValue,
int index)
Replaces the item at the given index. |
void |
select(int index)
Selects the item at the specified index. |
void |
setMultipleSelections(boolean v)
Sets whether this list should allow multiple selections or not. |
Methods inherited from class java.awt.Component |
action, bounds, checkImage, checkImage, createImage, createImage, deliverEvent, disable, enable, enable, getBackground, getColorModel, getFont, getFontMetrics, getForeground, getGraphics, getParent, getPeer, getToolkit, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isEnabled, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setFont, setForeground, show, show, size, toString, update, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public List()
public List(int rows, boolean multipleSelections)
rows
- the number of items to show.multipleSelections
- if true then multiple selections are allowed.Method Detail |
public void addNotify()
addNotify
in class Component
Component.getPeer()
,
Component.removeNotify()
public void removeNotify()
removeNotify
in class Component
Component.getPeer()
,
Component.addNotify()
public int countItems()
getItem(int)
public String getItem(int index)
index
- the position of the itemcountItems()
public void addItem(String item)
item
- the item to be addedpublic void addItem(String item, int index)
item
- the item to be addedindex
- 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.public void replaceItem(String newValue, int index)
newValue
- the new value to replace the existing itemindex
- the position of the item to replacepublic void clear()
delItem(int)
,
delItems(int, int)
public void delItem(int position)
public void delItems(int start, int end)
public int getSelectedIndex()
select(int)
,
deselect(int)
,
isSelected(int)
public int[] getSelectedIndexes()
select(int)
,
deselect(int)
,
isSelected(int)
public String getSelectedItem()
select(int)
,
deselect(int)
,
isSelected(int)
public String[] getSelectedItems()
select(int)
,
deselect(int)
,
isSelected(int)
public void select(int index)
index
- the position of the item to selectgetSelectedItem()
,
deselect(int)
,
isSelected(int)
public void deselect(int index)
index
- the position of the item to deselectselect(int)
,
getSelectedItem()
,
isSelected(int)
public boolean isSelected(int index)
index
- the item to be checkedselect(int)
,
deselect(int)
,
isSelected(int)
public int getRows()
public boolean allowsMultipleSelections()
setMultipleSelections(boolean)
public void setMultipleSelections(boolean v)
v
- the boolean to allow multiple selectionsallowsMultipleSelections()
public int getVisibleIndex()
public void makeVisible(int index)
index
- the position of the itemgetVisibleIndex()
public Dimension preferredSize(int rows)
rows
- amount of rows in list.public Dimension preferredSize()
preferredSize
in class Component
Component.minimumSize()
,
LayoutManager
public Dimension minimumSize(int rows)
rows
- minimum amount of rows in the listpublic Dimension minimumSize()
minimumSize
in class Component
Component.preferredSize()
,
LayoutManager
protected String paramString()
paramString
in class Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |