< prev index next >
src/java.desktop/share/classes/javax/swing/JList.java
Print this page
@@ -100,12 +100,12 @@
* 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 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,11 +252,11 @@
* 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.
+ * 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,11 +324,11 @@
private ListModel<E> dataModel;
private ListCellRenderer<? super E> cellRenderer;
private ListSelectionListener selectionListener;
/**
- * How to lay out the cells; defaults to <code>VERTICAL</code>.
+ * How to lay out the cells; defaults to {@code VERTICAL}.
*/
private int layoutOrientation;
/**
* The drop mode for this component.
@@ -339,12 +339,12 @@
* The drop location.
*/
private transient DropLocation dropLocation;
/**
- * A subclass of <code>TransferHandler.DropLocation</code> representing
- * a drop location for a <code>JList</code>.
+ * 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,19 +359,19 @@
/**
* 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>,
+ * {@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</code>, the return value refers to the index
+ * {@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</code>, the value of
- * <code>isInsert()</code> indicates whether the index is an index
+ * {@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</code> indicates that the drop occurred over empty space,
+ * {@code -1} indicates that the drop occurred over empty space,
* and no index could be calculated.
*
* @return the drop index
*/
public int getIndex() {
@@ -435,11 +435,11 @@
updateUI();
}
/**
- * Constructs a <code>JList</code> that displays the elements in
+ * 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,21 +460,21 @@
);
}
/**
- * Constructs a <code>JList</code> that displays the elements in
- * the specified <code>Vector</code>. This constructor creates a read-only
+ * 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</code> to be loaded into the
+ * @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,11 +484,11 @@
);
}
/**
- * Constructs a <code>JList</code> with an empty, read-only, model.
+ * Constructs a {@code JList} with an empty, read-only, model.
*/
public JList() {
this (
new AbstractListModel<E>() {
public int getSize() { return 0; }
@@ -500,22 +500,22 @@
/**
* Returns the {@code ListUI}, the look and feel object that
* renders this component.
*
- * @return the <code>ListUI</code> 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</code> object
+ * @param ui the {@code ListUI} object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* attribute: visualUpdate true
@@ -545,11 +545,11 @@
}
}
/**
- * Returns {@code "ListUI"}, the <code>UIDefaults</code> key used to look
+ * 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,17 +627,17 @@
* 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>.
+ * 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</code> and
- * <code>fixedCellHeight</code>
+ * {@code fixedCellWidth} and
+ * {@code fixedCellHeight}
* @see #getPrototypeCellValue
* @see #setFixedCellWidth
* @see #setFixedCellHeight
* @see JComponent#addPropertyChangeListener
* @beaninfo
@@ -672,11 +672,11 @@
}
/**
* 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
+ * 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,11 +708,11 @@
}
/**
* 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
+ * 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,19 +750,19 @@
* <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.
+ * {@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</code>
+ * @param cellRenderer the {@code ListCellRenderer}
* that paints list cells
* @see #getCellRenderer
* @beaninfo
* bound: true
* attribute: visualUpdate true
@@ -971,26 +971,26 @@
* 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>
+ * <tr><td>{@code VERTICAL}
* <td>Cells are layed out vertically in a single column.
- * <tr><td><code>HORIZONTAL_WRAP</code>
+ * <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</code>
+ * <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</code>.
+ * 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,11 +1134,11 @@
/**
* 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>.
+ * {@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,13 +1170,13 @@
* 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>
+ * {@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,29 +1203,29 @@
return dragEnabled;
}
/**
* Sets the drop mode for this component. For backward compatibility,
- * the default for this property is <code>DropMode.USE_SELECTION</code>.
+ * 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</code>, for instance,
+ * 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</code> supports the following drop modes:
+ * {@code JList} 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>
+ * <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</code> that accepts drops.
+ * {@code TransferHandler} that accepts drops.
*
* @param dropMode the drop mode to use
* @throws IllegalArgumentException if the drop mode is unsupported
- * or <code>null</code>
+ * or {@code null}
* @see #getDropMode
* @see #getDropLocation
* @see #setTransferHandler
* @see TransferHandler
* @since 1.6
@@ -1259,11 +1259,11 @@
/**
* 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>
+ * @return the drop location, or {@code null}
*/
DropLocation dropLocationForPoint(Point p) {
DropLocation location = null;
Rectangle rect = null;
@@ -1362,24 +1362,24 @@
* 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
+ * 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</code> since there's
+ * 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</code>) or <code>null</code>
+ * {@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</code>
+ * 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</code> if none
+ * @return any saved state for this component, or {@code null} if none
*/
Object setDropLocation(TransferHandler.DropLocation location,
Object state,
boolean forDrop) {
@@ -1429,11 +1429,11 @@
* 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>
+ * 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,15 +1512,15 @@
* 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
+ * <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</code> is unregistered, by way of a call to
+ * {@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,13 +1639,13 @@
*/
/**
* Returns the data model that holds the list of items displayed
- * by the <code>JList</code> component.
+ * by the {@code JList} component.
*
- * @return the <code>ListModel</code> that provides the displayed
+ * @return the {@code ListModel} that provides the displayed
* list of items
* @see #setModel
*/
public ListModel<E> getModel() {
return dataModel;
@@ -1656,14 +1656,14 @@
* 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
+ * @param model the {@code ListModel} that provides the
* list of items for display
- * @exception IllegalArgumentException if <code>model</code> is
- * <code>null</code>
+ * @exception IllegalArgumentException if {@code model} is
+ * {@code null}
* @see #getModel
* @see #clearSelection
* @beaninfo
* bound: true
* attribute: visualUpdate true
@@ -1679,11 +1679,11 @@
clearSelection();
}
/**
- * Constructs a read-only <code>ListModel</code> from an array of items,
+ * 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,19 +1702,19 @@
);
}
/**
- * Constructs a read-only <code>ListModel</code> from a <code>Vector</code>
+ * 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</code> containing the items to
+ * @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,11 +1749,11 @@
/**
* 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
+ * @return the {@code ListSelectionModel} that maintains the
* list's selections
*
* @see #setSelectionModel
* @see ListSelectionModel
*/
@@ -1864,22 +1864,22 @@
return listenerList.getListeners(ListSelectionListener.class);
}
/**
- * Sets the <code>selectionModel</code> for the list to a
- * non-<code>null</code> <code>ListSelectionModel</code>
+ * 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</code> that
+ * @param selectionModel the {@code ListSelectionModel} that
* implements the selections
- * @exception IllegalArgumentException if <code>selectionModel</code>
- * is <code>null</code>
+ * @exception IllegalArgumentException if {@code selectionModel}
+ * is {@code null}
* @see #getSelectionModel
* @beaninfo
* bound: true
* description: The selection model, recording which cells are selected.
*/
@@ -2878,11 +2878,11 @@
* 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.
+ * 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,15 +3046,15 @@
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>.
+ * Returns the {@code Accessible} child contained at
+ * the local coordinate {@code Point}, if one exists.
+ * Otherwise returns {@code null}.
*
- * @return the <code>Accessible</code> at the specified
+ * @return the {@code Accessible} at the specified
* location, if it exists
*/
public Accessible getAccessibleAt(Point p) {
int i = locationToIndex(p);
if (i >= 0) {
@@ -3116,11 +3116,11 @@
/**
* 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>.
+ * 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,15 +3723,15 @@
}
// 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
+ * 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</code> array if none
+ * or a {@code null} array if none
* @since 1.3
*/
public AccessibleIcon [] getAccessibleIcon() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
< prev index next >