public class List extends EventProxyContainer implements java.awt.ItemSelectable, java.awt.event.ActionListener, java.awt.event.ItemListener
List component presents the user with a scrolling list
of text items. The list can be set up so that the user can choose either
one item or multiple items.
A List is an MVC-based component. The model of the List is a
TextListModel object, the view of the List is a
TextListView object, and the controller of the List
is a TextListController object.
A List emits a ListActionEvent and a ListItemEvent.
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected java.awt.event.ActionListener |
actionListener |
protected static java.lang.String |
actionListenerK
Internal constant for serialization
|
protected static int |
DEFAULT_VISIBLE_ROWS
The default number of visible rows is 4.
|
protected java.awt.event.ItemListener |
itemListener |
protected static java.lang.String |
itemListenerK
Internal constant for serialization
|
protected TextListController |
listController |
protected TextListModel |
listModel |
protected TextListView |
listView |
static int |
MULTIPLE_SELECTIONS
Allows AWT style multiple selections.
|
protected int |
rows |
static int |
SHIFT_MULTIPLE_SELECTIONS
Allows Windows style multiple selections.
|
static int |
SINGLE_SELECTION
Allows single selection.
|
focusTraversable| 修飾子 | コンストラクタと説明 |
|---|---|
|
List()
Creates a new scrolling list.
|
|
List(int rows)
Creates a new scrolling list initialized with the specified
number of visible lines.
|
|
List(int rows,
boolean multipleMode)
Creates a new scrolling list initialized to display the specified
number of rows.
|
|
List(int rows,
boolean multipleMode,
int scrollbars)
Creates a new scrolling list initialized to display the specified
number of rows, multipleMode, and scroll bar visibility..
|
|
List(RichTextStyle richTextStyle,
int rows)
Creates a new scrolling list with the specified style and number of rows.
|
|
List(RichTextStyle richTextStyle,
int rows,
boolean multipleMode)
Creates a new scrolling list with the specified style, number of rows,
and multipleMode.
|
|
List(RichTextStyle richTextStyle,
int rows,
boolean multipleMode,
int scrollbars)
Creates a new scrolling list with the specified style, number of rows,
multipleMode, and scroll bar visibility.
|
protected |
List(TextListModel textListModel)
Creates a new scrolling list with the specified model.
|
|
List(TextListModel textListModel,
int rows)
Creates a new scrolling list with the specified model and number of rows.
|
|
List(TextListModel textListModel,
int rows,
boolean multipleMode)
Creates a new scrolling list with the specified model, number of rows,
and multipleMode.
|
|
List(TextListModel textListModel,
int rows,
boolean multipleMode,
int scrollbars)
Creates a new scrolling list with the specified model, number of rows,
multipleMode, and scroll bar visibility.
|
|
List(TextListModel textListModel,
int rows,
boolean multipleMode,
int scrollbars,
VBorder border)
Creates a new scrolling list with the specified model, number of rows,
multipleMode, scroll bar visibility, and border visual.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action occurs.
|
void |
add(java.lang.String item)
Adds the specified item to the end of scrolling list.
|
void |
add(java.lang.String item,
int index)
Adds the specified item to the the scrolling list.
|
void |
add(Text item)
Adds the specified text item to the end of scrolling list.
|
void |
add(Text item,
int index)
Adds the specified item to the scrolling list.
|
void |
addActionListener(java.awt.event.ActionListener l)
Adds the specified action listener to receive action events from
this list.
|
void |
addItem(java.lang.String item)
Adds the specified item to the end of scrolling list.
|
void |
addItem(java.lang.String item,
int index)
Adds the specified item to the the scrolling list.
|
void |
addItem(Text item)
Adds the specified text item to the end of scrolling list.
|
void |
addItem(Text item,
int index)
Adds the specified text item to the scrolling list.
|
void |
addItemListener(java.awt.event.ItemListener l)
Adds the specified item listener to receive item events from this list.
|
void |
addTextItem(Text item)
Adds the specified text item to the end of the scrolling list.
|
void |
addTextItem(Text item,
int index)
Adds the specified text item to the end of the scrolling list.
|
boolean |
allowsMultipleSelections()
非推奨です。
As of JDK version 1.1,
replaced by
isMultipleMode(). |
void |
clear()
非推奨です。
As of JDK version 1.1,
replaced by
removeAll(). |
int |
countItems()
非推奨です。
As of JDK version 1.1,
replaced by
getItemCount(). |
void |
delItem(int position)
Removes the item at the specified position from this list.
|
void |
delItems(int start,
int end)
非推奨です。
As of JDK version 1.1,
|
void |
deselect(int index)
Deselects the item at the specified index.
|
TextListController |
getController()
Returns the controller of this list.
|
protected java.awt.Component |
getEventSource()
Gets the event source component.
|
java.lang.String |
getItem(int index)
Returns the item associated with the specified index.
|
int |
getItemCount()
Returns the number of items in the list.
|
java.lang.String[] |
getItems()
Returns the items in the list.
|
java.awt.Dimension |
getMinimumSize()
Returns the minimum size of this scrolling list.
|
java.awt.Dimension |
getMinimumSize(int rows)
Returns the minumum dimensions for a list with the specified number
of rows.
|
TextListModel |
getModel()
Returns the model of this list.
|
java.awt.PopupMenu |
getPopupMenu()
Returns the popup menu of this list.
|
java.awt.Dimension |
getPreferredSize()
Returns the preferred size of this scrolling list.
|
java.awt.Dimension |
getPreferredSize(int rows)
Returns the preferred dimensions for a list with the specified number
of rows.
|
int |
getRows()
Get the number of visible lines in this list.
|
int |
getScrollbarThickness()
Returns the thickness of the scroll bar.
|
int |
getSelectedIndex()
Gets the index of the selected item on the list,
|
int[] |
getSelectedIndexes()
Gets the selected indexes on the list.
|
java.lang.String |
getSelectedItem()
Get the selected item on this scrolling list.
|
java.lang.String[] |
getSelectedItems()
Get the selected items on this scrolling list.
|
java.lang.Object[] |
getSelectedObjects()
Returns the selected items on the list in an array of Objects.
|
Text |
getSelectedTextItem()
Get the selected text item on this scrolling list.
|
Text[] |
getSelectedTextItems()
Get the selected text items on this scrolling list.
|
java.awt.Color |
getSelectionBackground()
Returns the selection background color.
|
java.awt.Color |
getSelectionForeground()
Returns the selection foreground color.
|
int |
getSelectionMode()
Returns the selection mode.
|
Text |
getTextItem(int index)
Returns the text item associated with the specified index.
|
Text[] |
getTextItems()
Returns the text items in the list.
|
TextListView |
getView()
Returns the view of this list.
|
int |
getVisibleIndex()
Gets the index of the item that was last made visible by the method
makeVisible. |
boolean |
isClickToFocus()
Tests if the list requests the focus when the mouse is clicked.
|
boolean |
isDeselectionEnabled()
Tests if the deselection is enabled when the selection mode is a single
selection.
|
boolean |
isIndexSelected(int index)
Determines if the specified item in this scrolling list is selected.
|
boolean |
isMouseFocus()
Tests if the list requests the focus when the mouse enters the list.
|
boolean |
isMultipleMode()
Determines whether this list allows multiple selections.
|
boolean |
isSelected(int index)
非推奨です。
As of JDK version 1.1,
replaced by
isIndexSelected(int). |
void |
itemStateChanged(java.awt.event.ItemEvent e)
Invoked when an item's state has been changed.
|
void |
makeVisible(int index)
Makes the item at the specified index visible.
|
java.awt.Dimension |
minimumSize(int rows)
非推奨です。
As of JDK version 1.1,
replaced by
getMinimumSize(int). |
java.awt.Dimension |
preferredSize(int rows)
非推奨です。
As of JDK version 1.1,
replaced by
getPreferredSize(int). |
protected void |
processEvent(java.awt.AWTEvent e) |
void |
remove(int position)
Remove the item at the specified position from this scrolling list.
|
void |
remove(int[] indices)
Remove the items at the specified row indices.
|
void |
remove(int start,
int end)
Remove the items at the specified row range.
|
void |
remove(java.lang.String item)
Removes the first occurrence of an item from the list.
|
void |
removeActionListener(java.awt.event.ActionListener l)
Removes the specified action listener so that it no longer receives
action events from this list.
|
void |
removeAll()
Removes all items 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 |
removeSelectedIndexes()
Remove the items at the indices of the selected rows.
|
void |
replaceItem(java.lang.String newValue,
int index)
Replaces the item at the specified index in the scrolling list
with the new string.
|
void |
replaceItem(Text newValue,
int index)
Replaces the item at the specified index in the scrolling list
with the new text.
|
void |
replaceTextItem(Text newValue,
int index)
Replaces the item at the specified index in the scrolling list
with the new text.
|
void |
select(int index)
Selects the item at the specified index in the scrolling list.
|
void |
select(java.lang.String item)
Sets the selected item in this list to be the item whose name is
equal to the specified string.
|
void |
setBackground(java.awt.Color c)
Sets the background color of this list.
|
void |
setClickToFocus()
Makes the list request the focus when the mouse is clicked.
|
void |
setCursor(java.awt.Cursor c)
Sets the cursor of this list.
|
void |
setDeselectionEnabled(boolean b)
Makes the deselection enabled when the selection mode is a single
selection.
|
void |
setEnabled(boolean b)
Enables or disables this list.
|
void |
setFont(java.awt.Font f)
Sets the font of this list.
|
void |
setForeground(java.awt.Color c)
Sets the foreground color of this list.
|
void |
setItems(java.lang.String[] items)
Sets the items of the list to the specified string items.
|
void |
setItems(Text[] items)
Sets the items of the list to the specified text items.
|
void |
setMouseFocus()
Makes the list request the focus when the mouse enters the list.
|
void |
setMultipleMode(boolean b)
Sets the flag that determines whether this list allows multiple
selections.
|
void |
setMultipleSelections(boolean b)
非推奨です。
As of JDK version 1.1,
replaced by
setMultipleMode(boolean). |
void |
setPopupMenu(java.awt.PopupMenu menu)
Sets the popup menu of this list.
|
void |
setRows(int rows)
Sets the number of visible lines in this list.
|
void |
setScrollbarThickness(int thickness)
Sets the thickness of the scroll bar.
|
void |
setSelectionBackground(java.awt.Color c)
Sets the selection background color.
|
void |
setSelectionForeground(java.awt.Color c)
Sets the selection foreground color.
|
void |
setSelectionMode(int mode)
Sets the selection mode.
|
void |
setTextItems(Text[] items)
Sets the items of the list to the specified text items.
|
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, delegateFocusEvent, delegateKeyEvent, delegateMouseEvent, focusGained, focusLost, getToolTipText, getToolTipVisual, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, setToolTipText, setToolTipText, setToolTipVisualaddNotify, bounds, disable, doLayout, enable, enable, getBounds, getFrame, getInsets, getLocation, getSize, hide, insets, isDirectNotification, isFocusTraversable, layout, location, minimumSize, postOldEvent, preferredSize, repaintNow, requestFocus, reshape, setBounds, setFocusTraversable, setVisible, show, show, size, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMousePosition, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, list, list, locate, paint, paintComponents, paramString, print, printComponents, processContainerEvent, remove, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseWheelListener, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected TextListModel listModel
protected TextListView listView
protected TextListController listController
protected int rows
protected transient java.awt.event.ItemListener itemListener
protected transient java.awt.event.ActionListener actionListener
public static final int SINGLE_SELECTION
public static final int MULTIPLE_SELECTIONS
public static final int SHIFT_MULTIPLE_SELECTIONS
protected static final int DEFAULT_VISIBLE_ROWS
protected static final java.lang.String itemListenerK
protected static final java.lang.String actionListenerK
public List()
public List(int rows)
rows - the number of items to show.public List(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 List(int rows,
boolean multipleMode,
int scrollbars)
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.scrollbars - a constant that determines what scrollbars are
created to view the list.public List(RichTextStyle richTextStyle, int rows)
richTextStyle - the style of the text list model.rows - the number of items to show.public List(RichTextStyle richTextStyle, int rows, boolean multipleMode)
richTextStyle - the style of the text list model.rows - the number of items to show.multipleMode - if true, then multiple selections
are allowed; otherwise, only one item can bepublic List(RichTextStyle richTextStyle, int rows, boolean multipleMode, int scrollbars)
richTextStyle - the style of the text list model.rows - the number of items to show.multipleMode - if true, then multiple selections
are allowed; otherwise, only one item can bescrollbars - a constant that determines what scrollbars are
created to view the list.public List(TextListModel textListModel, int rows)
textListModel - the text list model.rows - the number of items to show.public List(TextListModel textListModel, int rows, boolean multipleMode)
textListModel - the text list model.rows - the number of items to show.multipleMode - if true, then multiple selections
are allowed; otherwise, only one item can bepublic List(TextListModel textListModel, int rows, boolean multipleMode, int scrollbars)
textListModel - the text list model.rows - the number of items to show.multipleMode - if true, then multiple selections
are allowed; otherwise, only one item can bescrollbars - a constant that determines what scrollbars are
created to view the list.public List(TextListModel textListModel, int rows, boolean multipleMode, int scrollbars, VBorder border)
textListModel - the text list model.rows - the number of items to show.multipleMode - if true, then multiple selections
are allowed; otherwise, only one item can bescrollbars - a constant that determines what scrollbars are
created to view the list.border - the border visual of the list.protected List(TextListModel textListModel)
protected java.awt.Component getEventSource()
getEventSource クラス内 EventProxyContainerpublic void addItemListener(java.awt.event.ItemListener l)
addItemListener インタフェース内 java.awt.ItemSelectablel - the item listener.public void removeItemListener(java.awt.event.ItemListener l)
removeItemListener インタフェース内 java.awt.ItemSelectablel - the item listener.public void addActionListener(java.awt.event.ActionListener l)
l - the action listener.public void removeActionListener(java.awt.event.ActionListener l)
l - the action listener.public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged インタフェース内 java.awt.event.ItemListenerItemListenerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed インタフェース内 java.awt.event.ActionListenerActionListenerprotected void processEvent(java.awt.AWTEvent e)
processEvent クラス内 java.awt.Containerpublic void setForeground(java.awt.Color c)
setForeground クラス内 java.awt.Componentpublic void setBackground(java.awt.Color c)
setBackground クラス内 java.awt.Componentpublic void setFont(java.awt.Font f)
setFont クラス内 java.awt.Containerpublic void setCursor(java.awt.Cursor c)
setCursor クラス内 java.awt.Componentpublic void setEnabled(boolean b)
setEnabled クラス内 KContainerpublic int getItemCount()
#getItem()public int countItems()
getItemCount().public java.lang.String getItem(int index)
index - the position of the item.getItemCount()public java.lang.String[] getItems()
public void add(java.lang.String item)
item - the item to be added.public void addItem(java.lang.String item)
public void add(java.lang.String item,
int index)
-1
then the item is added to the end. If value of the index is greater
than the number of items in the list, the item is added at the end.item - the item to be added.index - the position at which to add the item.public void addItem(java.lang.String item,
int index)
-1
then the item is added to the end. If value of the index is greater
than the number of items in the list, the item is added at the end.item - the item to be added.index - the position at which to add the item.public void replaceItem(java.lang.String newValue,
int index)
newValue - a new string to replace an existing item.index - the position of the item to replace.public void removeAll()
removeAll クラス内 java.awt.Containerremove(int),
#delItems()public void clear()
removeAll().public void remove(java.lang.String item)
item - the item to remove from the list.public void remove(int position)
remove クラス内 java.awt.Containerposition - the index of the item to delete.#add(java.awt.String, int)public void delItem(int position)
public void delItems(int start,
int end)
public int getSelectedIndex()
-1 if no
item is selected, or if more that one item is selected.public int[] getSelectedIndexes()
public java.lang.String getSelectedItem()
public java.lang.String[] getSelectedItems()
public java.lang.Object[] getSelectedObjects()
getSelectedObjects インタフェース内 java.awt.ItemSelectableItemSelectablepublic void select(int index)
index - the position of the item to select.public void deselect(int index)
If the item at the specified index is not selected, or if the index is out of range, then the operation is ignored.
index - the position of the item to deselect.public boolean isIndexSelected(int index)
index - the item to be checked.true if the specified item has been selected;
false otherwise.public boolean isSelected(int index)
isIndexSelected(int).public int getRows()
setRows(int)public void setRows(int rows)
rows - the number of visible lines in this scrolling list.getRows()public boolean isMultipleMode()
true if this list allows multiple selections;
false otherwise.#setMultipleMode(int),
getSelectionMode(),
setSelectionMode(int)public boolean allowsMultipleSelections()
isMultipleMode().public void setMultipleMode(boolean b)
b - if true then multiple selections are allowed;
otherwise, only one item from the list can be selected at once.isMultipleMode(),
getSelectionMode(),
setSelectionMode(int)public void setMultipleSelections(boolean b)
setMultipleMode(boolean).public int getVisibleIndex()
makeVisible.makeVisible(int)public void makeVisible(int index)
index - the position of the item.getVisibleIndex()public java.awt.Dimension getPreferredSize(int rows)
rows - number of rows in the list.public java.awt.Dimension preferredSize(int rows)
getPreferredSize(int).public java.awt.Dimension getPreferredSize()
getPreferredSize クラス内 KContainerpublic java.awt.Dimension getMinimumSize(int rows)
rows - number of rows in the list.public java.awt.Dimension minimumSize(int rows)
getMinimumSize(int).public java.awt.Dimension getMinimumSize()
getMinimumSize クラス内 KContainerpublic void select(java.lang.String item)
item - the specified stringpublic TextListModel getModel()
public TextListView getView()
public TextListController getController()
public java.awt.Color getSelectionForeground()
public void setSelectionForeground(java.awt.Color c)
getSelectionForeground()public java.awt.Color getSelectionBackground()
public void setSelectionBackground(java.awt.Color c)
getSelectionBackground()public java.awt.PopupMenu getPopupMenu()
public void setPopupMenu(java.awt.PopupMenu menu)
getPopupMenu()public boolean isClickToFocus()
true if the list requests the focus when the
mouse is clicked, false if the list requests
the focus when the mouse enters the view.isMouseFocus()public boolean isMouseFocus()
isClickToFocus()public void setClickToFocus()
isClickToFocus(),
setMouseFocus()public void setMouseFocus()
isMouseFocus(),
setClickToFocus()public boolean isDeselectionEnabled()
public void setDeselectionEnabled(boolean b)
isDeselectionEnabled()public int getSelectionMode()
public void setSelectionMode(int mode)
public void setItems(java.lang.String[] items)
public void setItems(Text[] items)
public void setTextItems(Text[] items)
public Text getTextItem(int index)
index - the position of the item.public Text[] getTextItems()
public void add(Text item)
item - the text item to be added.public void addItem(Text item)
public void add(Text item, int index)
-1
then the item is added to the end. If value of the index is greater
than the number of items in the list, the item is added at the end.item - the text item to be added.index - the position at which to add the item.public void addItem(Text item, int index)
-1
then the item is added to the end. If value of the index is greater
than the number of items in the list, the item is added at the end.item - the text item to be added.index - the position at which to add the item.public void addTextItem(Text item)
item - the text item to be added.public void addTextItem(Text item, int index)
-1
then the item is added to the end. If value of the index is greater
than the number of items in the list, the item is added at the end.item - the text item to be added.index - the position at which to add the item.public void replaceItem(Text newValue, int index)
newValue - a new text to replace an existing item.index - the position of the item to replace.public void replaceTextItem(Text newValue, int index)
newValue - a new text to replace an existing item.index - the position of the item to replace.public Text getSelectedTextItem()
public Text[] getSelectedTextItems()
public void remove(int start,
int end)
start - the starting row position, inclusive.end - the ending row position, inclusive.public void remove(int[] indices)
indices - the row indices to be removed.public void removeSelectedIndexes()
public int getScrollbarThickness()
public void setScrollbarThickness(int thickness)
#setScrollbarThickness()