javax.swing.plaf.basic
public class BasicListUI extends ListUI
Nested Class Summary | |
---|---|
class | BasicListUI.FocusHandler
A helper class which listens for {@link FocusEvent}s
from the JList. |
class | BasicListUI.ListDataHandler
A helper class which listens for {@link ListDataEvent}s generated by
the {@link JList}'s {@link ListModel}.
|
class | BasicListUI.ListSelectionHandler
A helper class which listens for {@link ListSelectionEvent}s
from the {@link JList}'s {@link ListSelectionModel}. |
class | BasicListUI.MouseInputHandler
A helper class which listens for {@link MouseEvent}s
from the {@link JList}. |
class | BasicListUI.PropertyChangeHandler
Helper class which listens to {@link PropertyChangeEvent}s
from the {@link JList}. |
Field Summary | |
---|---|
protected int | cellHeight
The height of a single cell in the list. |
protected int[] | cellHeights
An array of varying heights of cells in the list, in cases where each
cell might have a different height. |
protected static int | cellRendererChanged
A constant to indicate that the cellRenderer has changed. |
protected int | cellWidth The width of a single cell in the list. |
protected static int | fixedCellHeightChanged
A constant to indicate that the fixedCellHeight has changed. |
protected static int | fixedCellWidthChanged
A constant to indicate that the fixedCellWidth has changed. |
protected FocusListener | focusListener The current focus listener. |
protected static int | fontChanged
A constant to indicate that the font has changed. |
protected JList | list Saved reference to the list this UI was created for. |
protected ListDataListener | listDataListener The data listener listening to the model. |
protected ListSelectionListener | listSelectionListener The selection listener listening to the selection model. |
protected static int | modelChanged
A constant to indicate that the model has changed. |
protected MouseInputListener | mouseInputListener The mouse listener listening to the list. |
protected PropertyChangeListener | propertyChangeListener The property change listener listening to the list. |
protected static int | prototypeCellValueChanged
A constant to indicate that the prototypeCellValue has changed. |
protected CellRendererPane | rendererPane
The {@link CellRendererPane} that is used for painting. |
protected static int | selectionModelChanged
A constant to indicate that the selection model has changed. |
protected int | updateLayoutStateNeeded
A bitmask that indicates which properties of the JList have changed.
|
Constructor Summary | |
---|---|
BasicListUI()
Creates a new BasicListUI object. |
Method Summary | |
---|---|
protected int | convertRowToY(int row)
Calculate the Y coordinate of the upper edge of a particular row,
considering the Y coordinate 0 to occur at the top of the
list.
|
protected int | convertYToRow(int y0)
Calculate the row number containing a particular Y coordinate,
considering the Y coodrinate 0 to occur at the top of the
list.
|
protected FocusListener | createFocusListener()
Creates and returns the focus listener for this UI.
|
protected ListDataListener | createListDataListener()
Creates and returns the list data listener for this UI.
|
protected ListSelectionListener | createListSelectionListener()
Creates and returns the list selection listener for this UI.
|
protected MouseInputListener | createMouseInputListener()
Creates and returns the mouse input listener for this UI.
|
protected PropertyChangeListener | createPropertyChangeListener()
Creates and returns the property change listener for this UI.
|
static ComponentUI | createUI(JComponent c)
Creates a new BasicListUI for the component.
|
Rectangle | getCellBounds(JList l, int index1, int index2)
Calculate the bounds of a particular cell, considering the upper left
corner of the list as the origin position (0,0) .
|
Dimension | getPreferredSize(JComponent c)
Gets the size this list would prefer to assume. |
protected int | getRowHeight(int row)
Calculate the height of a particular row. |
Point | indexToLocation(JList l, int index) |
protected void | installDefaults()
Installs various default settings (mostly colors) from the {@link
UIDefaults} into the {@link JList}
|
protected void | installKeyboardActions()
Installs keyboard actions for this UI in the {@link JList}. |
protected void | installListeners()
Attaches all the listeners we have in the UI class to the {@link
JList}, its model and its selection model.
|
void | installUI(JComponent c)
Installs the various aspects of the UI in the {@link JList}. |
int | locationToIndex(JList l, Point location)
Computes the index of a list cell given a point within the list. |
protected void | maybeUpdateLayoutState()
Calls {@link #updateLayoutState} if {@link #updateLayoutStateNeeded}
is nonzero, then resets {@link #updateLayoutStateNeeded} to zero. |
void | paint(Graphics g, JComponent c)
Paints the list by repeatedly calling {@link #paintCell} for each visible
cell in the list.
|
protected void | paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, ListModel data, ListSelectionModel sel, int lead)
Paints a single cell in the list.
|
protected void | selectNextIndex()
Selects the next list item and force it to be visible. |
protected void | selectPreviousIndex()
Selects the previous list item and force it to be visible. |
protected void | uninstallDefaults()
Resets to null those defaults which were installed in
{@link #installDefaults} |
protected void | uninstallKeyboardActions()
Uninstalls keyboard actions for this UI in the {@link JList}. |
protected void | uninstallListeners()
Detaches all the listeners we attached in {@link #installListeners}. |
void | uninstallUI(JComponent c)
Uninstalls all the aspects of the UI which were installed in {@link
#installUI}. |
protected void | updateLayoutState()
Recomputes the {@link #cellHeights}, {@link #cellHeight}, and {@link
#cellWidth} properties by examining the variouis properties of the
{@link JList}. |
-1
and {@link #cellHeights} is used instead.fixedCellHeight
property of the list is not set. Otherwise
this field is null
and {@link #cellHeight} is used.See Also: modelChanged selectionModelChanged fontChanged fixedCellWidthChanged fixedCellHeightChanged prototypeCellValueChanged cellRendererChanged
0
to occur at the top of the
list.
Parameters: row The row to calculate the Y coordinate of
Returns: The Y coordinate of the specified row, or -1
if
the specified row number is invalid
0
to occur at the top of the
list.
Parameters: y0 The Y coordinate to calculate the row number for
Returns: The row number containing the specified Y value, or -1
if the list model is empty
UNKNOWN: This method is specified to return -1 for an invalid Y
coordinate. However, some simple tests show that the behaviour
is to return the index of the last list element for an Y
coordinate that lies outside of the list bounds (even for
negative indices). -1
is only returned if the list model is empty.
Returns: the focus listener for this UI
Returns: the list data listener for this UI
Returns: the list selection listener for this UI
Returns: the mouse input listener for this UI
Returns: the property change listener for this UI
Parameters: c The component to create a UI for
Returns: A new UI
(0,0)
.
Parameters: l Ignored; calculates over this.list
index1 The first row to include in the bounds index2 The last row to incude in the bounds
Returns: A rectangle encompassing the range of rows between
index1
and index2
inclusive, or null
such a rectangle couldn't be calculated for the given indexes.
Parameters: c Ignored; uses the saved {@link JList} reference
Returns: DOCUMENT ME!
-1
.
Parameters: row The row to get the height of
Returns: The height, in pixels, of the specified row
See Also: BasicListUI
See Also: BasicListUI
Parameters: c The {@link JList} to install the UI into
Parameters: l the list which on which the computation is based on location the coordinates
Returns: the index of the list item that is located at the given
coordinates or -1
if the list model is empty
Parameters: g The graphics context to paint with c Ignored; uses the saved {@link JList} reference
Parameters: g The graphics context to paint in row The row number to paint bounds The bounds of the cell to paint, assuming a coordinate
system beginning at (0,0)
in the upper left corner of the
list rend A cell renderer to paint with data The data to provide to the cell renderer sel A selection model to provide to the cell renderer lead The lead selection index of the list
null
those defaults which were installed in
{@link #installDefaults}Parameters: c Ignored; the UI is uninstalled from the {@link JList} reference saved during the call to {@link #installUI}