< prev index next >
src/java.desktop/share/classes/javax/swing/JList.java
Print this page
*** 100,111 ****
* date with changes, by listening to the model.
* <p>
* Simple, dynamic-content, {@code JList} applications can use the
* {@code DefaultListModel} class to maintain list elements. This class
* implements the {@code ListModel} interface and also provides a
! * <code>java.util.Vector</code>-like API. Applications that need a more
! * custom <code>ListModel</code> implementation may instead wish to subclass
* {@code AbstractListModel}, which provides basic support for managing and
* notifying listeners. For example, a read-only implementation of
* {@code AbstractListModel}:
* <pre>
* {@code
--- 100,111 ----
* date with changes, by listening to the model.
* <p>
* Simple, dynamic-content, {@code JList} applications can use the
* {@code DefaultListModel} class to maintain list elements. This class
* implements the {@code ListModel} interface and also provides a
! * {@code java.util.Vector}-like API. Applications that need a more
! * custom {@code ListModel} implementation may instead wish to subclass
* {@code AbstractListModel}, which provides basic support for managing and
* notifying listeners. For example, a read-only implementation of
* {@code AbstractListModel}:
* <pre>
* {@code
*** 252,262 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
* <p>
* See <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/list.html">How to Use Lists</a>
* in <a href="http://docs.oracle.com/javase/tutorial/"><em>The Java Tutorial</em></a>
* for further documentation.
--- 252,262 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
* <p>
* See <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/list.html">How to Use Lists</a>
* in <a href="http://docs.oracle.com/javase/tutorial/"><em>The Java Tutorial</em></a>
* for further documentation.
*** 324,334 ****
private ListModel<E> dataModel;
private ListCellRenderer<? super E> cellRenderer;
private ListSelectionListener selectionListener;
/**
! * How to lay out the cells; defaults to <code>VERTICAL</code>.
*/
private int layoutOrientation;
/**
* The drop mode for this component.
--- 324,334 ----
private ListModel<E> dataModel;
private ListCellRenderer<? super E> cellRenderer;
private ListSelectionListener selectionListener;
/**
! * How to lay out the cells; defaults to {@code VERTICAL}.
*/
private int layoutOrientation;
/**
* The drop mode for this component.
*** 339,350 ****
* The drop location.
*/
private transient DropLocation dropLocation;
/**
! * A subclass of <code>TransferHandler.DropLocation</code> representing
! * a drop location for a <code>JList</code>.
*
* @see #getDropLocation
* @since 1.6
*/
public static final class DropLocation extends TransferHandler.DropLocation {
--- 339,350 ----
* The drop location.
*/
private transient DropLocation dropLocation;
/**
! * A subclass of {@code TransferHandler.DropLocation} representing
! * a drop location for a {@code JList}.
*
* @see #getDropLocation
* @since 1.6
*/
public static final class DropLocation extends TransferHandler.DropLocation {
*** 359,377 ****
/**
* Returns the index where dropped data should be placed in the
* list. Interpretation of the value depends on the drop mode set on
* the associated component. If the drop mode is either
! * <code>DropMode.USE_SELECTION</code> or <code>DropMode.ON</code>,
* the return value is an index of a row in the list. If the drop mode is
! * <code>DropMode.INSERT</code>, the return value refers to the index
* where the data should be inserted. If the drop mode is
! * <code>DropMode.ON_OR_INSERT</code>, the value of
! * <code>isInsert()</code> indicates whether the index is an index
* of a row, or an insert index.
* <p>
! * <code>-1</code> indicates that the drop occurred over empty space,
* and no index could be calculated.
*
* @return the drop index
*/
public int getIndex() {
--- 359,377 ----
/**
* Returns the index where dropped data should be placed in the
* list. Interpretation of the value depends on the drop mode set on
* the associated component. If the drop mode is either
! * {@code DropMode.USE_SELECTION} or {@code DropMode.ON},
* the return value is an index of a row in the list. If the drop mode is
! * {@code DropMode.INSERT}, the return value refers to the index
* where the data should be inserted. If the drop mode is
! * {@code DropMode.ON_OR_INSERT}, the value of
! * {@code isInsert()} indicates whether the index is an index
* of a row, or an insert index.
* <p>
! * {@code -1} indicates that the drop occurred over empty space,
* and no index could be calculated.
*
* @return the drop index
*/
public int getIndex() {
*** 435,445 ****
updateUI();
}
/**
! * Constructs a <code>JList</code> that displays the elements in
* the specified array. This constructor creates a read-only model
* for the given array, and then delegates to the constructor that
* takes a {@code ListModel}.
* <p>
* Attempts to pass a {@code null} value to this method results in
--- 435,445 ----
updateUI();
}
/**
! * Constructs a {@code JList} that displays the elements in
* the specified array. This constructor creates a read-only model
* for the given array, and then delegates to the constructor that
* takes a {@code ListModel}.
* <p>
* Attempts to pass a {@code null} value to this method results in
*** 460,480 ****
);
}
/**
! * Constructs a <code>JList</code> that displays the elements in
! * the specified <code>Vector</code>. This constructor creates a read-only
* model for the given {@code Vector}, and then delegates to the constructor
* that takes a {@code ListModel}.
* <p>
* Attempts to pass a {@code null} value to this method results in
* undefined behavior and, most likely, exceptions. The created model
* references the given {@code Vector} directly. Attempts to modify the
* {@code Vector} after constructing the list results in undefined behavior.
*
! * @param listData the <code>Vector</code> to be loaded into the
* data model, {@code non-null}
*/
public JList(final Vector<? extends E> listData) {
this (
new AbstractListModel<E>() {
--- 460,480 ----
);
}
/**
! * Constructs a {@code JList} that displays the elements in
! * the specified {@code Vector}. This constructor creates a read-only
* model for the given {@code Vector}, and then delegates to the constructor
* that takes a {@code ListModel}.
* <p>
* Attempts to pass a {@code null} value to this method results in
* undefined behavior and, most likely, exceptions. The created model
* references the given {@code Vector} directly. Attempts to modify the
* {@code Vector} after constructing the list results in undefined behavior.
*
! * @param listData the {@code Vector} to be loaded into the
* data model, {@code non-null}
*/
public JList(final Vector<? extends E> listData) {
this (
new AbstractListModel<E>() {
*** 484,494 ****
);
}
/**
! * Constructs a <code>JList</code> with an empty, read-only, model.
*/
public JList() {
this (
new AbstractListModel<E>() {
public int getSize() { return 0; }
--- 484,494 ----
);
}
/**
! * Constructs a {@code JList} with an empty, read-only, model.
*/
public JList() {
this (
new AbstractListModel<E>() {
public int getSize() { return 0; }
*** 500,521 ****
/**
* Returns the {@code ListUI}, the look and feel object that
* renders this component.
*
! * @return the <code>ListUI</code> object that renders this component
*/
public ListUI getUI() {
return (ListUI)ui;
}
/**
* Sets the {@code ListUI}, the look and feel object that
* renders this component.
*
! * @param ui the <code>ListUI</code> object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* attribute: visualUpdate true
--- 500,521 ----
/**
* Returns the {@code ListUI}, the look and feel object that
* renders this component.
*
! * @return the {@code ListUI} object that renders this component
*/
public ListUI getUI() {
return (ListUI)ui;
}
/**
* Sets the {@code ListUI}, the look and feel object that
* renders this component.
*
! * @param ui the {@code ListUI} object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* attribute: visualUpdate true
*** 545,555 ****
}
}
/**
! * Returns {@code "ListUI"}, the <code>UIDefaults</code> key used to look
* up the name of the {@code javax.swing.plaf.ListUI} class that defines
* the look and feel for this component.
*
* @return the string "ListUI"
* @see JComponent#getUIClassID
--- 545,555 ----
}
}
/**
! * Returns {@code "ListUI"}, the {@code UIDefaults} key used to look
* up the name of the {@code javax.swing.plaf.ListUI} class that defines
* the look and feel for this component.
*
* @return the string "ListUI"
* @see JComponent#getUIClassID
*** 627,643 ****
* only sent when the {@code prototypeCellValue} property changes.
* <p>
* To see an example which sets this property, see the
* <a href="#prototype_example">class description</a> above.
* <p>
! * The default value of this property is <code>null</code>.
* <p>
* This is a JavaBeans bound property.
*
* @param prototypeCellValue the value on which to base
! * <code>fixedCellWidth</code> and
! * <code>fixedCellHeight</code>
* @see #getPrototypeCellValue
* @see #setFixedCellWidth
* @see #setFixedCellHeight
* @see JComponent#addPropertyChangeListener
* @beaninfo
--- 627,643 ----
* only sent when the {@code prototypeCellValue} property changes.
* <p>
* To see an example which sets this property, see the
* <a href="#prototype_example">class description</a> above.
* <p>
! * The default value of this property is {@code null}.
* <p>
* This is a JavaBeans bound property.
*
* @param prototypeCellValue the value on which to base
! * {@code fixedCellWidth} and
! * {@code fixedCellHeight}
* @see #getPrototypeCellValue
* @see #setFixedCellWidth
* @see #setFixedCellHeight
* @see JComponent#addPropertyChangeListener
* @beaninfo
*** 672,682 ****
}
/**
* Sets a fixed value to be used for the width of every cell in the list.
* If {@code width} is -1, cell widths are computed in the {@code ListUI}
! * by applying <code>getPreferredSize</code> to the cell renderer component
* for each list element.
* <p>
* The default value of this property is {@code -1}.
* <p>
* This is a JavaBeans bound property.
--- 672,682 ----
}
/**
* Sets a fixed value to be used for the width of every cell in the list.
* If {@code width} is -1, cell widths are computed in the {@code ListUI}
! * by applying {@code getPreferredSize} to the cell renderer component
* for each list element.
* <p>
* The default value of this property is {@code -1}.
* <p>
* This is a JavaBeans bound property.
*** 708,718 ****
}
/**
* Sets a fixed value to be used for the height of every cell in the list.
* If {@code height} is -1, cell heights are computed in the {@code ListUI}
! * by applying <code>getPreferredSize</code> to the cell renderer component
* for each list element.
* <p>
* The default value of this property is {@code -1}.
* <p>
* This is a JavaBeans bound property.
--- 708,718 ----
}
/**
* Sets a fixed value to be used for the height of every cell in the list.
* If {@code height} is -1, cell heights are computed in the {@code ListUI}
! * by applying {@code getPreferredSize} to the cell renderer component
* for each list element.
* <p>
* The default value of this property is {@code -1}.
* <p>
* This is a JavaBeans bound property.
*** 750,768 ****
* <a href="#renderer">class level documentation</a>.
* <p>
* If the {@code prototypeCellValue} property is {@code non-null},
* setting the cell renderer also causes the {@code fixedCellWidth} and
* {@code fixedCellHeight} properties to be re-calculated. Only one
! * <code>PropertyChangeEvent</code> is generated however -
! * for the <code>cellRenderer</code> property.
* <p>
* The default value of this property is provided by the {@code ListUI}
* delegate, i.e. by the look and feel implementation.
* <p>
* This is a JavaBeans bound property.
*
! * @param cellRenderer the <code>ListCellRenderer</code>
* that paints list cells
* @see #getCellRenderer
* @beaninfo
* bound: true
* attribute: visualUpdate true
--- 750,768 ----
* <a href="#renderer">class level documentation</a>.
* <p>
* If the {@code prototypeCellValue} property is {@code non-null},
* setting the cell renderer also causes the {@code fixedCellWidth} and
* {@code fixedCellHeight} properties to be re-calculated. Only one
! * {@code PropertyChangeEvent} is generated however -
! * for the {@code cellRenderer} property.
* <p>
* The default value of this property is provided by the {@code ListUI}
* delegate, i.e. by the look and feel implementation.
* <p>
* This is a JavaBeans bound property.
*
! * @param cellRenderer the {@code ListCellRenderer}
* that paints list cells
* @see #getCellRenderer
* @beaninfo
* bound: true
* attribute: visualUpdate true
*** 971,996 ****
* A description of these layouts follows:
*
* <table border="1"
* summary="Describes layouts VERTICAL, HORIZONTAL_WRAP, and VERTICAL_WRAP">
* <tr><th><p style="text-align:left">Value</p></th><th><p style="text-align:left">Description</p></th></tr>
! * <tr><td><code>VERTICAL</code>
* <td>Cells are layed out vertically in a single column.
! * <tr><td><code>HORIZONTAL_WRAP</code>
* <td>Cells are layed out horizontally, wrapping to a new row as
* necessary. If the {@code visibleRowCount} property is less than
* or equal to zero, wrapping is determined by the width of the
* list; otherwise wrapping is done in such a way as to ensure
* {@code visibleRowCount} rows in the list.
! * <tr><td><code>VERTICAL_WRAP</code>
* <td>Cells are layed out vertically, wrapping to a new column as
* necessary. If the {@code visibleRowCount} property is less than
* or equal to zero, wrapping is determined by the height of the
* list; otherwise wrapping is done at {@code visibleRowCount} rows.
* </table>
* <p>
! * The default value of this property is <code>VERTICAL</code>.
*
* @param layoutOrientation the new layout orientation, one of:
* {@code VERTICAL}, {@code HORIZONTAL_WRAP} or {@code VERTICAL_WRAP}
* @see #getLayoutOrientation
* @see #setVisibleRowCount
--- 971,996 ----
* A description of these layouts follows:
*
* <table border="1"
* summary="Describes layouts VERTICAL, HORIZONTAL_WRAP, and VERTICAL_WRAP">
* <tr><th><p style="text-align:left">Value</p></th><th><p style="text-align:left">Description</p></th></tr>
! * <tr><td>{@code VERTICAL}
* <td>Cells are layed out vertically in a single column.
! * <tr><td>{@code HORIZONTAL_WRAP}
* <td>Cells are layed out horizontally, wrapping to a new row as
* necessary. If the {@code visibleRowCount} property is less than
* or equal to zero, wrapping is determined by the width of the
* list; otherwise wrapping is done in such a way as to ensure
* {@code visibleRowCount} rows in the list.
! * <tr><td>{@code VERTICAL_WRAP}
* <td>Cells are layed out vertically, wrapping to a new column as
* necessary. If the {@code visibleRowCount} property is less than
* or equal to zero, wrapping is determined by the height of the
* list; otherwise wrapping is done at {@code visibleRowCount} rows.
* </table>
* <p>
! * The default value of this property is {@code VERTICAL}.
*
* @param layoutOrientation the new layout orientation, one of:
* {@code VERTICAL}, {@code HORIZONTAL_WRAP} or {@code VERTICAL_WRAP}
* @see #getLayoutOrientation
* @see #setVisibleRowCount
*** 1134,1144 ****
/**
* Scrolls the list within an enclosing viewport to make the specified
* cell completely visible. This calls {@code scrollRectToVisible} with
* the bounds of the specified cell. For this method to work, the
! * {@code JList} must be within a <code>JViewport</code>.
* <p>
* If the given index is outside the list's range of cells, this method
* results in nothing.
*
* @param index the index of the cell to make visible
--- 1134,1144 ----
/**
* Scrolls the list within an enclosing viewport to make the specified
* cell completely visible. This calls {@code scrollRectToVisible} with
* the bounds of the specified cell. For this method to work, the
! * {@code JList} must be within a {@code JViewport}.
* <p>
* If the given index is outside the list's range of cells, this method
* results in nothing.
*
* @param index the index of the cell to make visible
*** 1170,1182 ****
* begin a drag and drop operation by calling {@code exportAsDrag} on the
* list's {@code TransferHandler}.
*
* @param b whether or not to enable automatic drag handling
* @exception HeadlessException if
! * <code>b</code> is <code>true</code> and
! * <code>GraphicsEnvironment.isHeadless()</code>
! * returns <code>true</code>
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #getDragEnabled
* @see #setTransferHandler
* @see TransferHandler
* @since 1.4
--- 1170,1182 ----
* begin a drag and drop operation by calling {@code exportAsDrag} on the
* list's {@code TransferHandler}.
*
* @param b whether or not to enable automatic drag handling
* @exception HeadlessException if
! * {@code b} is {@code true} and
! * {@code GraphicsEnvironment.isHeadless()}
! * returns {@code true}
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #getDragEnabled
* @see #setTransferHandler
* @see TransferHandler
* @since 1.4
*** 1203,1231 ****
return dragEnabled;
}
/**
* Sets the drop mode for this component. For backward compatibility,
! * the default for this property is <code>DropMode.USE_SELECTION</code>.
* Usage of one of the other modes is recommended, however, for an
! * improved user experience. <code>DropMode.ON</code>, for instance,
* offers similar behavior of showing items as selected, but does so without
* affecting the actual selection in the list.
* <p>
! * <code>JList</code> supports the following drop modes:
* <ul>
! * <li><code>DropMode.USE_SELECTION</code></li>
! * <li><code>DropMode.ON</code></li>
! * <li><code>DropMode.INSERT</code></li>
! * <li><code>DropMode.ON_OR_INSERT</code></li>
* </ul>
* The drop mode is only meaningful if this component has a
! * <code>TransferHandler</code> that accepts drops.
*
* @param dropMode the drop mode to use
* @throws IllegalArgumentException if the drop mode is unsupported
! * or <code>null</code>
* @see #getDropMode
* @see #getDropLocation
* @see #setTransferHandler
* @see TransferHandler
* @since 1.6
--- 1203,1231 ----
return dragEnabled;
}
/**
* Sets the drop mode for this component. For backward compatibility,
! * the default for this property is {@code DropMode.USE_SELECTION}.
* Usage of one of the other modes is recommended, however, for an
! * improved user experience. {@code DropMode.ON}, for instance,
* offers similar behavior of showing items as selected, but does so without
* affecting the actual selection in the list.
* <p>
! * {@code JList} supports the following drop modes:
* <ul>
! * <li>{@code DropMode.USE_SELECTION}</li>
! * <li>{@code DropMode.ON}</li>
! * <li>{@code DropMode.INSERT}</li>
! * <li>{@code DropMode.ON_OR_INSERT}</li>
* </ul>
* The drop mode is only meaningful if this component has a
! * {@code TransferHandler} that accepts drops.
*
* @param dropMode the drop mode to use
* @throws IllegalArgumentException if the drop mode is unsupported
! * or {@code null}
* @see #getDropMode
* @see #getDropLocation
* @see #setTransferHandler
* @see TransferHandler
* @since 1.6
*** 1259,1269 ****
/**
* Calculates a drop location in this component, representing where a
* drop at the given point should insert data.
*
* @param p the point to calculate a drop location for
! * @return the drop location, or <code>null</code>
*/
DropLocation dropLocationForPoint(Point p) {
DropLocation location = null;
Rectangle rect = null;
--- 1259,1269 ----
/**
* Calculates a drop location in this component, representing where a
* drop at the given point should insert data.
*
* @param p the point to calculate a drop location for
! * @return the drop location, or {@code null}
*/
DropLocation dropLocationForPoint(Point p) {
DropLocation location = null;
Rectangle rect = null;
*** 1362,1385 ****
* a drop index). It can return a state object to the caller encapsulating
* any saved selection state. On a second call, let's say the drop location
* is being changed to something else. The component doesn't need to
* restore anything yet, so it simply passes back the same state object
* to have the DnD system continue storing it. Finally, let's say this
! * method is messaged with <code>null</code>. This means DnD
* is finished with this component for now, meaning it should restore
* state. At this point, it can use the state parameter to restore
! * said state, and of course return <code>null</code> since there's
* no longer anything to store.
*
* @param location the drop location (as calculated by
! * <code>dropLocationForPoint</code>) or <code>null</code>
* if there's no longer a valid drop location
* @param state the state object saved earlier for this component,
! * or <code>null</code>
* @param forDrop whether or not the method is being called because an
* actual drop occurred
! * @return any saved state for this component, or <code>null</code> if none
*/
Object setDropLocation(TransferHandler.DropLocation location,
Object state,
boolean forDrop) {
--- 1362,1385 ----
* a drop index). It can return a state object to the caller encapsulating
* any saved selection state. On a second call, let's say the drop location
* is being changed to something else. The component doesn't need to
* restore anything yet, so it simply passes back the same state object
* to have the DnD system continue storing it. Finally, let's say this
! * method is messaged with {@code null}. This means DnD
* is finished with this component for now, meaning it should restore
* state. At this point, it can use the state parameter to restore
! * said state, and of course return {@code null} since there's
* no longer anything to store.
*
* @param location the drop location (as calculated by
! * {@code dropLocationForPoint}) or {@code null}
* if there's no longer a valid drop location
* @param state the state object saved earlier for this component,
! * or {@code null}
* @param forDrop whether or not the method is being called because an
* actual drop occurred
! * @return any saved state for this component, or {@code null} if none
*/
Object setDropLocation(TransferHandler.DropLocation location,
Object state,
boolean forDrop) {
*** 1429,1439 ****
* as the drop location during a DnD operation over the component,
* or {@code null} if no location is to currently be shown.
* <p>
* This method is not meant for querying the drop location
* from a {@code TransferHandler}, as the drop location is only
! * set after the {@code TransferHandler}'s <code>canImport</code>
* has returned and has allowed for the location to be shown.
* <p>
* When this property changes, a property change event with
* name "dropLocation" is fired by the component.
* <p>
--- 1429,1439 ----
* as the drop location during a DnD operation over the component,
* or {@code null} if no location is to currently be shown.
* <p>
* This method is not meant for querying the drop location
* from a {@code TransferHandler}, as the drop location is only
! * set after the {@code TransferHandler}'s {@code canImport}
* has returned and has allowed for the location to be shown.
* <p>
* When this property changes, a property change event with
* name "dropLocation" is fired by the component.
* <p>
*** 1512,1526 ****
* renderer component for the cell over which the event occurred, returning
* its tooltip text, if any. This implementation allows you to specify
* tooltip text on the cell level, by using {@code setToolTipText} on your
* cell renderer component.
* <p>
! * <strong>Note:</strong> For <code>JList</code> to properly display the
! * tooltips of its renderers in this manner, <code>JList</code> must be a
! * registered component with the <code>ToolTipManager</code>. This registration
* is done automatically in the constructor. However, if at a later point
! * <code>JList</code> is unregistered, by way of a call to
* {@code setToolTipText(null)}, tips from the renderers will no longer display.
*
* @param event the {@code MouseEvent} to fetch the tooltip text for
* @see JComponent#setToolTipText
* @see JComponent#getToolTipText
--- 1512,1526 ----
* renderer component for the cell over which the event occurred, returning
* its tooltip text, if any. This implementation allows you to specify
* tooltip text on the cell level, by using {@code setToolTipText} on your
* cell renderer component.
* <p>
! * <strong>Note:</strong> For {@code JList} to properly display the
! * tooltips of its renderers in this manner, {@code JList} must be a
! * registered component with the {@code ToolTipManager}. This registration
* is done automatically in the constructor. However, if at a later point
! * {@code JList} is unregistered, by way of a call to
* {@code setToolTipText(null)}, tips from the renderers will no longer display.
*
* @param event the {@code MouseEvent} to fetch the tooltip text for
* @see JComponent#setToolTipText
* @see JComponent#getToolTipText
*** 1639,1651 ****
*/
/**
* Returns the data model that holds the list of items displayed
! * by the <code>JList</code> component.
*
! * @return the <code>ListModel</code> that provides the displayed
* list of items
* @see #setModel
*/
public ListModel<E> getModel() {
return dataModel;
--- 1639,1651 ----
*/
/**
* Returns the data model that holds the list of items displayed
! * by the {@code JList} component.
*
! * @return the {@code ListModel} that provides the displayed
* list of items
* @see #setModel
*/
public ListModel<E> getModel() {
return dataModel;
*** 1656,1669 ****
* list, notifies property change listeners, and then clears the
* list's selection.
* <p>
* This is a JavaBeans bound property.
*
! * @param model the <code>ListModel</code> that provides the
* list of items for display
! * @exception IllegalArgumentException if <code>model</code> is
! * <code>null</code>
* @see #getModel
* @see #clearSelection
* @beaninfo
* bound: true
* attribute: visualUpdate true
--- 1656,1669 ----
* list, notifies property change listeners, and then clears the
* list's selection.
* <p>
* This is a JavaBeans bound property.
*
! * @param model the {@code ListModel} that provides the
* list of items for display
! * @exception IllegalArgumentException if {@code model} is
! * {@code null}
* @see #getModel
* @see #clearSelection
* @beaninfo
* bound: true
* attribute: visualUpdate true
*** 1679,1689 ****
clearSelection();
}
/**
! * Constructs a read-only <code>ListModel</code> from an array of items,
* and calls {@code setModel} with this model.
* <p>
* Attempts to pass a {@code null} value to this method results in
* undefined behavior and, most likely, exceptions. The created model
* references the given array directly. Attempts to modify the array
--- 1679,1689 ----
clearSelection();
}
/**
! * Constructs a read-only {@code ListModel} from an array of items,
* and calls {@code setModel} with this model.
* <p>
* Attempts to pass a {@code null} value to this method results in
* undefined behavior and, most likely, exceptions. The created model
* references the given array directly. Attempts to modify the array
*** 1702,1720 ****
);
}
/**
! * Constructs a read-only <code>ListModel</code> from a <code>Vector</code>
* and calls {@code setModel} with this model.
* <p>
* Attempts to pass a {@code null} value to this method results in
* undefined behavior and, most likely, exceptions. The created model
* references the given {@code Vector} directly. Attempts to modify the
* {@code Vector} after invoking this method results in undefined behavior.
*
! * @param listData a <code>Vector</code> containing the items to
* display in the list
* @see #setModel
*/
public void setListData(final Vector<? extends E> listData) {
setModel (
--- 1702,1720 ----
);
}
/**
! * Constructs a read-only {@code ListModel} from a {@code Vector}
* and calls {@code setModel} with this model.
* <p>
* Attempts to pass a {@code null} value to this method results in
* undefined behavior and, most likely, exceptions. The created model
* references the given {@code Vector} directly. Attempts to modify the
* {@code Vector} after invoking this method results in undefined behavior.
*
! * @param listData a {@code Vector} containing the items to
* display in the list
* @see #setModel
*/
public void setListData(final Vector<? extends E> listData) {
setModel (
*** 1749,1759 ****
/**
* Returns the current selection model. The selection model maintains the
* selection state of the list. See the class level documentation for more
* details.
*
! * @return the <code>ListSelectionModel</code> that maintains the
* list's selections
*
* @see #setSelectionModel
* @see ListSelectionModel
*/
--- 1749,1759 ----
/**
* Returns the current selection model. The selection model maintains the
* selection state of the list. See the class level documentation for more
* details.
*
! * @return the {@code ListSelectionModel} that maintains the
* list's selections
*
* @see #setSelectionModel
* @see ListSelectionModel
*/
*** 1864,1885 ****
return listenerList.getListeners(ListSelectionListener.class);
}
/**
! * Sets the <code>selectionModel</code> for the list to a
! * non-<code>null</code> <code>ListSelectionModel</code>
* implementation. The selection model handles the task of making single
* selections, selections of contiguous ranges, and non-contiguous
* selections.
* <p>
* This is a JavaBeans bound property.
*
! * @param selectionModel the <code>ListSelectionModel</code> that
* implements the selections
! * @exception IllegalArgumentException if <code>selectionModel</code>
! * is <code>null</code>
* @see #getSelectionModel
* @beaninfo
* bound: true
* description: The selection model, recording which cells are selected.
*/
--- 1864,1885 ----
return listenerList.getListeners(ListSelectionListener.class);
}
/**
! * Sets the {@code selectionModel} for the list to a
! * non-{@code null ListSelectionModel}
* implementation. The selection model handles the task of making single
* selections, selections of contiguous ranges, and non-contiguous
* selections.
* <p>
* This is a JavaBeans bound property.
*
! * @param selectionModel the {@code ListSelectionModel} that
* implements the selections
! * @exception IllegalArgumentException if {@code selectionModel}
! * is {@code null}
* @see #getSelectionModel
* @beaninfo
* bound: true
* description: The selection model, recording which cells are selected.
*/
*** 2878,2888 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJList extends AccessibleJComponent
implements AccessibleSelection, PropertyChangeListener,
--- 2878,2888 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJList extends AccessibleJComponent
implements AccessibleSelection, PropertyChangeListener,
*** 3046,3060 ****
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LIST;
}
/**
! * Returns the <code>Accessible</code> child contained at
! * the local coordinate <code>Point</code>, if one exists.
! * Otherwise returns <code>null</code>.
*
! * @return the <code>Accessible</code> at the specified
* location, if it exists
*/
public Accessible getAccessibleAt(Point p) {
int i = locationToIndex(p);
if (i >= 0) {
--- 3046,3060 ----
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LIST;
}
/**
! * Returns the {@code Accessible} child contained at
! * the local coordinate {@code Point}, if one exists.
! * Otherwise returns {@code null}.
*
! * @return the {@code Accessible} at the specified
* location, if it exists
*/
public Accessible getAccessibleAt(Point p) {
int i = locationToIndex(p);
if (i >= 0) {
*** 3116,3126 ****
/**
* Returns an Accessible representing the specified selected item
* in the object. If there isn't a selection, or there are
* fewer items selected than the integer passed in, the return
! * value will be <code>null</code>.
*
* @param i the zero-based index of selected items
* @return an Accessible containing the selected item
*/
public Accessible getAccessibleSelection(int i) {
--- 3116,3126 ----
/**
* Returns an Accessible representing the specified selected item
* in the object. If there isn't a selection, or there are
* fewer items selected than the integer passed in, the return
! * value will be {@code null}.
*
* @param i the zero-based index of selected items
* @return an Accessible containing the selected item
*/
public Accessible getAccessibleSelection(int i) {
*** 3723,3737 ****
}
// TIGER - 4733624
/**
* Returns the icon for the element renderer, as the only item
! * of an array of <code>AccessibleIcon</code>s or a <code>null</code> array
* if the renderer component contains no icons.
*
* @return an array containing the accessible icon
! * or a <code>null</code> array if none
* @since 1.3
*/
public AccessibleIcon [] getAccessibleIcon() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
--- 3723,3737 ----
}
// TIGER - 4733624
/**
* Returns the icon for the element renderer, as the only item
! * of an array of {@code AccessibleIcon}s or a {@code null} array
* if the renderer component contains no icons.
*
* @return an array containing the accessible icon
! * or a {@code null} array if none
* @since 1.3
*/
public AccessibleIcon [] getAccessibleIcon() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
< prev index next >