|
|||||||||
| Home >> All >> javax >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.swing
Class JList

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JList
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, Scrollable, java.io.Serializable
- public class JList
- extends JComponent
- implements javax.accessibility.Accessible, Scrollable
- extends JComponent
This class is a facade over three separate objects: ListModel, ListSelectionModel and javax.swing.plaf.ListUI. The facade represents a unified "list" concept, with independently replacable (possibly client-provided) models for its contents and its current selection. In addition, each element in the list is rendered via a strategy class ListCellRenderer.
Lists have many properties, some of which are stored in this class while others are delegated to the list's model or selection. The following properties are available:
| Property | Stored in | Bound? |
|---|---|---|
| accessibleContext | list | no |
| anchorSelectionIndex | selection | no |
| cellRenderer | list | yes |
| dragEnabled | list | no |
| firstVisibleIndex | list | no |
| fixedCellHeight | list | yes |
| fixedCellWidth | list | yes |
| lastVisibleIndex | list | no |
| layoutOrientation | list | yes |
| leadSelectionIndex | selection | no |
| maxSelectionIndex | selection | no |
| minSelectionIndex | selection | no |
| model | list | yes |
| opaque | list | no |
| preferredScrollableViewportSize | list | no |
| prototypeCellValue | list | yes |
| scrollableTracksViewportHeight | list | no |
| scrollableTracksViewportWidth | list | no |
| selectedIndex | selection | no |
| selectedIndices | selection | no |
| selectedValue | model | no |
| selectedValues | model | no |
| selectionBackground | list | yes |
| selectionEmpty | selection | no |
| selectionForeground | list | yes |
| selectionMode | selection | no |
| selectionModel | list | yes |
| UI | list | yes |
| UIClassID | list | no |
| valueIsAdjusting | list | no |
| visibleRowCount | list | no |
| Nested Class Summary | |
protected class |
JList.AccessibleJList
Provides accessibility support for JList. |
private class |
JList.ListListener
This private listener propagates javax.swing.event.ListSelectionEvent events from the list's "selectionModel" property to the list's javax.swing.event.ListSelectionListener listeners. |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
(package private) ListCellRenderer |
cellRenderer
This property provides a strategy for rendering cells in the list. |
(package private) boolean |
dragEnabled
This property indicates whether "drag and drop" functions are enabled on the list. |
(package private) int |
fixedCellHeight
This property indicates an fixed height to assign to all cells in the list. |
(package private) int |
fixedCellWidth
This property indicates an fixed width to assign to all cells in the list. |
static int |
HORIZONTAL_WRAP
Constant value used in "layoutOrientation" property. |
(package private) int |
layoutOrientation
This property holds the current layout orientation of the list, which is one of the integer constants VERTICAL 55 , VERTICAL_WRAP 55 , or HORIZONTAL_WRAP 55 . |
(package private) JList.ListListener |
listListener
Shared ListListener instance, subscribed to both the current model 55 and selectionModel 55 properties of the list. |
(package private) ListModel |
model
This property holds the data elements displayed by the list. |
(package private) java.lang.Object |
prototypeCellValue
This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate the fixedCellWidth 55 and fixedCellHeight 55 properties, using the
cellRenderer 55 property to acquire a component to render the
prototype. |
(package private) java.awt.Color |
selectionBackground
This property specifies a foreground color for the selected cells in the list. |
(package private) java.awt.Color |
selectionForeground
This property specifies a background color for the selected cells in the list. |
(package private) ListSelectionModel |
selectionModel
This property holds a description of which data elements in the model 55 property should be considered "selected", when displaying and
interacting with the list. |
private static long |
serialVersionUID
|
(package private) boolean |
valueIsAdjusting
This property indicates that the list's selection is currently "adjusting" -- perhaps due to a user actively dragging the mouse over multiple list elements -- and is therefore likely to change again in the near future. |
static int |
VERTICAL
Constant value used in "layoutOrientation" property. |
static int |
VERTICAL_WRAP
Constant value used in "layoutOrientation" property. |
(package private) int |
visibleRowCount
This property indicates a preference for the number of rows displayed in the list, and will scale the getPreferredScrollableViewportSize() 55 property accordingly. |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, alignmentX, alignmentY, autoscrolls, border, debugGraphicsOptions, doubleBuffered, isCompletelyDirty, isPaintingDoubleBuffered, listenerList, maximumSize, minimumSize, opaque, preferredSize, requestFocusEnabled, TOOL_TIP_TEXT_KEY, toolTipText, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JList()
Creates a new JList object. |
|
JList(ListModel model)
Creates a new JList object. |
|
JList(java.lang.Object[] items)
Creates a new JList object. |
|
JList(java.util.Vector items)
Creates a new JList object. |
|
| Method Summary | |
void |
addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a javax.swing.event.ListSelectionListener to the listener list for this list. |
void |
addSelectionInterval(int anchor,
int lead)
Adds the specified interval to the current selection. |
void |
clearSelection()
Clears the current selection. |
private ListModel |
createListModel(java.lang.Object[] items)
Returns a ListModel backed by the specified array. |
private ListModel |
createListModel(java.util.Vector items)
Returns a ListModel backed by the specified vector. |
protected ListSelectionModel |
createSelectionModel()
Creates the default ListSelectionModel. |
void |
ensureIndexIsVisible(int i)
Scrolls this list to make the specified cell visible. |
protected void |
fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
Fire a javax.swing.event.ListSelectionEvent to all the registered ListSelectionListeners. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
If a component supports the Accessibility API then this method should not return null. |
int |
getAnchorSelectionIndex()
Returns the index of the anchor item in the current selection, or -1 if there is no anchor item. |
java.awt.Rectangle |
getCellBounds(int index0,
int index1)
Returns the bounds of the rectangle that encloses both list cells with index0 and index1. |
ListCellRenderer |
getCellRenderer()
Gets the value of the cellRenderer 55 property. |
boolean |
getDragEnabled()
Return the value of the dragEnabled property. |
int |
getFirstVisibleIndex()
Returns the list index of the upper left or upper right corner of the visible rectangle of this list, depending on the Component.getComponentOrientation()> Component.getComponentOrientation() 55 property. |
int |
getFixedCellHeight()
Gets the value of the fixedCellHeight 55 property. |
int |
getFixedCellWidth()
Gets the value of the fixedCellWidth 55 property. |
int |
getLastVisibleIndex()
Returns the list index of the lower right or lower left corner of the visible rectangle of this list, depending on the Component.getComponentOrientation()> Component.getComponentOrientation() 55 property. |
int |
getLayoutOrientation()
Returns the layout orientation. |
int |
getLeadSelectionIndex()
Returns the index of the lead item in the current selection, or -1 if there is no lead item. |
javax.swing.event.ListSelectionListener[] |
getListSelectionListeners()
Returns an array of all ListSelectionListeners subscribed to this list. |
int |
getMaxSelectionIndex()
Returns the highest item index in the current selection, or -1 if there is no selection. |
int |
getMinSelectionIndex()
Returns the lowest item index in the current selection, or -1
if there is no selection. |
ListModel |
getModel()
Gets the value of the model 55 property. |
int |
getNextMatch(java.lang.String prefix,
int startIndex,
javax.swing.text.Position.Bias bias)
Returns the next list element (beginning from startIndex
that starts with prefix. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns a size indicating how much space this list would like to consume, when contained in a scrollable viewport. |
java.lang.Object |
getPrototypeCellValue()
Returns the current value of the prototypeCellValue 55
property. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Return the number of pixels the list must scroll in order to move a "block" of the list into the provided visible rectangle. |
boolean |
getScrollableTracksViewportHeight()
Gets the value of the scrollableTracksViewportWidth property. |
boolean |
getScrollableTracksViewportWidth()
Gets the value of the scrollableTracksViewportWidth property. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Return the number of pixels the list must scroll in order to move a "unit" of the list into the provided visible rectangle. |
int |
getSelectedIndex()
Returns the minimum index of an element in the list which is currently selected. |
int[] |
getSelectedIndices()
Returns the indices of values in the model 55 property which are
selected. |
java.lang.Object |
getSelectedValue()
Returns the first value in the list's model 55 property which is
selected, according to the list's selectionModel 55 property. |
java.lang.Object[] |
getSelectedValues()
Returns all the values in the list's model 55 property which
are selected, according to the list's selectionModel 55 property. |
java.awt.Color |
getSelectionBackground()
Gets the value of the selectionBackground 55 property. |
java.awt.Color |
getSelectionForeground()
Gets the value of the selectionForeground 55 property. |
int |
getSelectionMode()
Returns the selection mode for the list (one of: ListSelectionModel.SINGLE_SELECTION 55 ,
ListSelectionModel.SINGLE_INTERVAL_SELECTION 55 and
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION 55 ). |
ListSelectionModel |
getSelectionModel()
Returns the selection model for the JList.AccessibleJList component. |
javax.swing.plaf.ListUI |
getUI()
Gets the value of the UI property. |
java.lang.String |
getUIClassID()
Return the class identifier for the list's UI property. |
boolean |
getValueIsAdjusting()
Returns the value of the valueIsAdjusting property. |
int |
getVisibleRowCount()
Gets the value of the visibleRowCount 55 property. |
java.awt.Point |
indexToLocation(int index)
Returns location of the cell located at the specified index in the list. |
private void |
init(ListModel m)
Initializes the list. |
boolean |
isSelectedIndex(int a)
Indicates whether the list element at a given index value is currently selected. |
boolean |
isSelectionEmpty()
Returns true if the model's selection is empty, otherwise
false. |
int |
locationToIndex(java.awt.Point location)
Returns index of the cell to which specified location is closest to. |
protected java.lang.String |
paramString()
Returns a string describing the attributes for the JList
component, for use in debugging. |
void |
removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a javax.swing.event.ListSelectionListener from the listener list for this list. |
void |
removeSelectionInterval(int index0,
int index1)
Removes the specified interval from the current selection. |
void |
setCellRenderer(ListCellRenderer renderer)
Sets the value of the getCellRenderer() 55 property. |
void |
setDragEnabled(boolean enabled)
Set the dragEnabled property. |
void |
setFixedCellHeight(int h)
Sets the value of the fixedCellHeight 55 property. |
void |
setFixedCellWidth(int w)
Sets the value of the fixedCellWidth 55 property. |
void |
setLayoutOrientation(int orientation)
Sets the layout orientation. |
void |
setListData(java.lang.Object[] listData)
Sets the model 55 property of the list to a new anonymous
AbstractListModel subclass which accesses the provided Object
array directly. |
void |
setListData(java.util.Vector listData)
Sets the model 55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided vector
directly. |
void |
setModel(ListModel model)
Sets the value of the model 55 property. |
void |
setPrototypeCellValue(java.lang.Object obj)
Set the prototypeCellValue 55 property. |
void |
setSelectedIndex(int a)
Adds the interval [a,a] to the set of selections managed
by this list's selectionModel 55 property. |
void |
setSelectedIndices(int[] a)
For each element a[i] of the provided array
a, calls setSelectedIndex(int) 55 on a[i]. |
void |
setSelectedValue(java.lang.Object obj,
boolean scroll)
Sets the selection to cover only the specified value, if it exists in the model. |
void |
setSelectionBackground(java.awt.Color c)
Sets the value of the selectionBackground 55 property. |
void |
setSelectionForeground(java.awt.Color c)
Sets the value of the selectionForeground 55 property. |
void |
setSelectionInterval(int anchor,
int lead)
Sets the current selection to the items in the specified range (inclusive). |
void |
setSelectionMode(int a)
Sets the list's "selectionMode" property, which simply mirrors the same property on the list's selectionModel 55 property. |
void |
setSelectionModel(ListSelectionModel model)
Sets the value of the selectionModel 55 property. |
void |
setUI(javax.swing.plaf.ListUI ui)
Sets the value of the UI property. |
void |
setValueIsAdjusting(boolean isAdjusting)
Sets the valueIsAdjusting property. |
void |
setVisibleRowCount(int vc)
Sets the value of the visibleRowCount 55 property. |
void |
updateUI()
Calls setUI(javax.swing.plaf.ListUI) 55 with the javax.swing.plaf.ListUI subclass
returned from calling UIManager.getUI(javax.swing.JComponent) 55 . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
VERTICAL
public static final int VERTICAL
- Constant value used in "layoutOrientation" property. This value means
that cells are laid out in a single vertical column. This is the default.
- See Also:
- Constant Field Values
VERTICAL_WRAP
public static final int VERTICAL_WRAP
- Constant value used in "layoutOrientation" property. This value means
that cells are laid out in multiple columns "newspaper style", filling
vertically first, then horizontally.
- See Also:
- Constant Field Values
HORIZONTAL_WRAP
public static final int HORIZONTAL_WRAP
- Constant value used in "layoutOrientation" property. This value means
that cells are laid out in multiple columns "newspaper style",
filling horizontally first, then vertically.
- See Also:
- Constant Field Values
dragEnabled
boolean dragEnabled
- This property indicates whether "drag and drop" functions are enabled
on the list.
cellRenderer
ListCellRenderer cellRenderer
- This property provides a strategy for rendering cells in the list.
fixedCellWidth
int fixedCellWidth
- This property indicates an fixed width to assign to all cells in the
list. If its value is
-1, no width has been assigned. This value can be set explicitly, or implicitly by setting theprototypeCellValue55 property.
fixedCellHeight
int fixedCellHeight
- This property indicates an fixed height to assign to all cells in the
list. If its value is
-1, no height has been assigned. This value can be set explicitly, or implicitly by setting theprototypeCellValue55 property.
layoutOrientation
int layoutOrientation
- This property holds the current layout orientation of the list, which
is one of the integer constants
VERTICAL55 ,VERTICAL_WRAP55 , orHORIZONTAL_WRAP55 .
model
ListModel model
- This property holds the data elements displayed by the list.
prototypeCellValue
java.lang.Object prototypeCellValue
This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate the
fixedCellWidth55 andfixedCellHeight55 properties, using thecellRenderer55 property to acquire a component to render the prototype.It is important that you not set this value to a component. It has to be a data value such as the objects you would find in the list's model. Setting it to a component will have undefined (and undesirable) affects.
selectionBackground
java.awt.Color selectionBackground
- This property specifies a foreground color for the selected cells in
the list. When
ListCellRenderer.getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)55 is called with a selected cell object, the component returned will have its "foreground" set to this color.
selectionForeground
java.awt.Color selectionForeground
- This property specifies a background color for the selected cells in
the list. When
ListCellRenderer.getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)55 is called with a selected cell object, the component returned will have its "background" property set to this color.
selectionModel
ListSelectionModel selectionModel
- This property holds a description of which data elements in the
model55 property should be considered "selected", when displaying and interacting with the list.
valueIsAdjusting
boolean valueIsAdjusting
- This property indicates that the list's selection is currently
"adjusting" -- perhaps due to a user actively dragging the mouse over
multiple list elements -- and is therefore likely to change again in
the near future. A javax.swing.event.ListSelectionListener might choose to delay
updating its view of the list's selection until this property is
false, meaning that the adjustment has completed.
visibleRowCount
int visibleRowCount
- This property indicates a preference for the number of rows
displayed in the list, and will scale the
getPreferredScrollableViewportSize()55 property accordingly. The actual number of displayed rows, when the list is placed in a real JViewport or other component, may be greater or less than this number.
listListener
JList.ListListener listListener
- Shared ListListener instance, subscribed to both the current
model55 andselectionModel55 properties of the list.
| Constructor Detail |
JList
public JList()
- Creates a new
JListobject.
JList
public JList(java.lang.Object[] items)
- Creates a new
JListobject.
JList
public JList(java.util.Vector items)
- Creates a new
JListobject.
JList
public JList(ListModel model)
- Creates a new
JListobject.
| Method Detail |
fireSelectionValueChanged
protected void fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
- Fire a javax.swing.event.ListSelectionEvent to all the registered
ListSelectionListeners.
init
private void init(ListModel m)
- Initializes the list.
createSelectionModel
protected ListSelectionModel createSelectionModel()
- Creates the default
ListSelectionModel.
getFixedCellHeight
public int getFixedCellHeight()
- Gets the value of the
fixedCellHeight55 property. This property may be-1to indicate that no cell height has been set. This property is also set implicitly when theprototypeCellValue55 property is set.
setFixedCellHeight
public void setFixedCellHeight(int h)
- Sets the value of the
fixedCellHeight55 property. This property may be-1to indicate that no cell height has been set. This property is also set implicitly when theprototypeCellValue55 property is set, but setting it explicitly overrides the height computed fromprototypeCellValue55 .
getFixedCellWidth
public int getFixedCellWidth()
- Gets the value of the
fixedCellWidth55 property. This property may be-1to indicate that no cell width has been set. This property is also set implicitly when theprototypeCellValue55 property is set.
setFixedCellWidth
public void setFixedCellWidth(int w)
- Sets the value of the
fixedCellWidth55 property. This property may be-1to indicate that no cell width has been set. This property is also set implicitly when theprototypeCellValue55 property is set, but setting it explicitly overrides the width computed fromprototypeCellValue55 .
getVisibleRowCount
public int getVisibleRowCount()
- Gets the value of the
visibleRowCount55 property.
setVisibleRowCount
public void setVisibleRowCount(int vc)
- Sets the value of the
visibleRowCount55 property.
addListSelectionListener
public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
- Adds a javax.swing.event.ListSelectionListener to the listener list for this
list. The listener will be called back with a javax.swing.event.ListSelectionEvent any time the list's
selectionModel55 property changes. The source of such events will be the JList, not the selection model.
removeListSelectionListener
public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
- Removes a javax.swing.event.ListSelectionListener from the listener list for
this list. The listener will no longer be called when the list's
selectionModel55 changes.
getListSelectionListeners
public javax.swing.event.ListSelectionListener[] getListSelectionListeners()
- Returns an array of all ListSelectionListeners subscribed to this
list.
- Since:
- 1.4
getSelectionMode
public int getSelectionMode()
- Returns the selection mode for the list (one of:
ListSelectionModel.SINGLE_SELECTION55 ,ListSelectionModel.SINGLE_INTERVAL_SELECTION55 andListSelectionModel.MULTIPLE_INTERVAL_SELECTION55 ).
setSelectionMode
public void setSelectionMode(int a)
- Sets the list's "selectionMode" property, which simply mirrors the
same property on the list's
selectionModel55 property. This property should be one of the integer constantsSINGLE_SELECTION,SINGLE_INTERVAL_SELECTION, orMULTIPLE_INTERVAL_SELECTIONfrom the ListSelectionModel interface.
setSelectedIndex
public void setSelectedIndex(int a)
- Adds the interval
[a,a]to the set of selections managed by this list'sselectionModel55 property. Depending on the selection mode, this may cause existing selections to become invalid, or may simply expand the set of selections.
setSelectedIndices
public void setSelectedIndices(int[] a)
- For each element
a[i]of the provided arraya, callssetSelectedIndex(int)55 ona[i].
getSelectedIndex
public int getSelectedIndex()
- Returns the minimum index of an element in the list which is currently
selected.
isSelectionEmpty
public boolean isSelectionEmpty()
- Returns
trueif the model's selection is empty, otherwisefalse.
getFirstVisibleIndex
public int getFirstVisibleIndex()
- Returns the list index of the upper left or upper right corner of the
visible rectangle of this list, depending on the Component.getComponentOrientation()>
Component.getComponentOrientation()55 property.
locationToIndex
public int locationToIndex(java.awt.Point location)
- Returns index of the cell to which specified location is closest to. If
the location is outside the bounds of the list, then the greatest index
in the list model is returned. If the list model is empty, then
-1is returned.
indexToLocation
public java.awt.Point indexToLocation(int index)
- Returns location of the cell located at the specified index in the list.
getLastVisibleIndex
public int getLastVisibleIndex()
- Returns the list index of the lower right or lower left corner of the
visible rectangle of this list, depending on the Component.getComponentOrientation()>
Component.getComponentOrientation()55 property.
getSelectedIndices
public int[] getSelectedIndices()
- Returns the indices of values in the
model55 property which are selected.
isSelectedIndex
public boolean isSelectedIndex(int a)
- Indicates whether the list element at a given index value is
currently selected.
getSelectedValue
public java.lang.Object getSelectedValue()
- Returns the first value in the list's
model55 property which is selected, according to the list'sselectionModel55 property. This is equivalent to callinggetModel()getElementAt(getSelectedIndex()), with a check for the special index value of-1which returns nullnull.
getSelectedValues
public java.lang.Object[] getSelectedValues()
- Returns all the values in the list's
model55 property which are selected, according to the list'sselectionModel55 property.
getSelectionBackground
public java.awt.Color getSelectionBackground()
- Gets the value of the
selectionBackground55 property.
setSelectionBackground
public void setSelectionBackground(java.awt.Color c)
- Sets the value of the
selectionBackground55 property.
getSelectionForeground
public java.awt.Color getSelectionForeground()
- Gets the value of the
selectionForeground55 property.
setSelectionForeground
public void setSelectionForeground(java.awt.Color c)
- Sets the value of the
selectionForeground55 property.
setSelectedValue
public void setSelectedValue(java.lang.Object obj, boolean scroll)
- Sets the selection to cover only the specified value, if it
exists in the model.
ensureIndexIsVisible
public void ensureIndexIsVisible(int i)
- Scrolls this list to make the specified cell visible. This
only works if the list is contained within a viewport.
setListData
public void setListData(java.lang.Object[] listData)
- Sets the
model55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided Object array directly.
createListModel
private ListModel createListModel(java.lang.Object[] items)
- Returns a ListModel backed by the specified array.
createListModel
private ListModel createListModel(java.util.Vector items)
- Returns a ListModel backed by the specified vector.
setListData
public void setListData(java.util.Vector listData)
- Sets the
model55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided vector directly.
getCellRenderer
public ListCellRenderer getCellRenderer()
- Gets the value of the
cellRenderer55 property.
setCellRenderer
public void setCellRenderer(ListCellRenderer renderer)
- Sets the value of the
getCellRenderer()55 property.
getModel
public ListModel getModel()
- Gets the value of the
model55 property.
setModel
public void setModel(ListModel model)
- Sets the value of the
model55 property. The list'slistListener55 is unsubscribed from the existing model, if it exists, and re-subscribed to the new model.
getSelectionModel
public ListSelectionModel getSelectionModel()
- Returns the selection model for the JList.AccessibleJList component. Note that
this class contains a range of convenience methods for configuring the
selection model:
clearSelection()55 ;setSelectionMode(int)55 ;addSelectionInterval(int, int)55 ;setSelectedIndex(int)55 ;setSelectedIndices(int[])55 ;setSelectionInterval(int, int)55 .
setSelectionModel
public void setSelectionModel(ListSelectionModel model)
- Sets the value of the
selectionModel55 property. The list'slistListener55 is unsubscribed from the existing selection model, if it exists, and re-subscribed to the new selection model.
getUI
public javax.swing.plaf.ListUI getUI()
- Gets the value of the UI property.
setUI
public void setUI(javax.swing.plaf.ListUI ui)
- Sets the value of the UI property.
updateUI
public void updateUI()
- Calls
setUI(javax.swing.plaf.ListUI)55 with the javax.swing.plaf.ListUI subclass returned from callingUIManager.getUI(javax.swing.JComponent)55 .- Overrides:
updateUIin classJComponent
getUIClassID
public java.lang.String getUIClassID()
- Return the class identifier for the list's UI property. This should
be the constant string
"ListUI", and map to an appropriate UI class in the UIManager.- Overrides:
getUIClassIDin classJComponent
getPrototypeCellValue
public java.lang.Object getPrototypeCellValue()
- Returns the current value of the
prototypeCellValue55 property. This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate thefixedCellWidth55 andfixedCellHeight55 properties, using thecellRenderer55 property to acquire a component to render the prototype.
setPrototypeCellValue
public void setPrototypeCellValue(java.lang.Object obj)
Set the
prototypeCellValue55 property. This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate thefixedCellWidth55 andfixedCellHeight55 properties, using thecellRenderer55 property to acquire a component to render the prototype.It is important that you not set this value to a component. It has to be a data value such as the objects you would find in the list's model. Setting it to a component will have undefined (and undesirable) affects.
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Description copied from interface:
javax.accessibility.Accessible - If a component supports the Accessibility API then this method should
not return
null. Only classes which must extend an accessible class, but must not itself be accessible, may return null.- Specified by:
JAVADOC