javax.swing.plaf.basic
Class BasicListUI

java.lang.Object
  extended byjavax.swing.plaf.ComponentUI
      extended byjavax.swing.plaf.ListUI
          extended byjavax.swing.plaf.basic.BasicListUI

public class BasicListUI
extends ListUI

A Windows L&F implementation of ListUI.

Author:
Hans Muller, Philip Milne

Nested Class Summary
private static class BasicListUI.ClearSelectionAction
          Action to clear the selection in the list.
private static class BasicListUI.EndAction
          Action to move the selection to the last item in the list.
 class BasicListUI.FocusHandler
          This inner class is marked "public" due to a compiler bug.
private static class BasicListUI.HomeAction
          Action to move the selection to the first item in the list.
private static class BasicListUI.IncrementLeadByColumnAction
          IncrementLeadByColumnAction extends the selection to the next column.
private static class BasicListUI.IncrementLeadSelectionAction
          Action to increment the selection in the list up/down a row at a type.
private static class BasicListUI.KeyHandler
           
 class BasicListUI.ListDataHandler
          The ListDataListener that's added to the JLists model at installUI time, and whenever the JList.model property changes.
(package private) static class BasicListUI.ListDragGestureRecognizer
          Drag gesture recognizer for JList components
(package private)  class BasicListUI.ListDropTargetListener
          A DropTargetListener to extend the default Swing handling of drop operations by moving the list selection to the nearest location to the mouse pointer.
 class BasicListUI.ListSelectionHandler
          The ListSelectionListener that's added to the JLists selection model at installUI time, and whenever the JList.selectionModel property changes.
(package private) static class BasicListUI.ListTransferHandler
           
 class BasicListUI.MouseInputHandler
          Mouse input, and focus handling for JList.
private static class BasicListUI.PageDownAction
          Action to move down one page.
private static class BasicListUI.PageUpAction
          Action to move up one page.
 class BasicListUI.PropertyChangeHandler
          The PropertyChangeListener that's added to the JList at installUI time.
private static class BasicListUI.SelectAllAction
          Action to select all the items in the list.
 
Field Summary
protected  int cellHeight
           
protected  int[] cellHeights
           
protected static int cellRendererChanged
           
protected  int cellWidth
           
private static int CHANGE_LEAD
          Used by IncrementLeadSelectionAction.
private static int CHANGE_SELECTION
          Used by IncrementLeadSelectionAction.
private  int columnCount
          Number of columns to create.
private static int componentOrientationChanged
           
private static BasicListUI.ListDragGestureRecognizer defaultDragRecognizer
           
private static TransferHandler defaultTransferHandler
           
private static int EXTEND_SELECTION
          Used by IncrementLeadSelectionAction.
protected static int fixedCellHeightChanged
           
protected static int fixedCellWidthChanged
           
protected  FocusListener focusListener
           
protected static int fontChanged
           
private static int heightChanged
           
private  KeyListener keyListener
           
private  int layoutOrientation
          The layout orientation of the list.
private static int layoutOrientationChanged
           
protected  JList list
           
protected  ListDataListener listDataListener
           
private  int listHeight
          Height of the list.
protected  ListSelectionListener listSelectionListener
           
private  int listWidth
          Width of the list.
protected static int modelChanged
           
protected  MouseInputListener mouseInputListener
           
private  int preferredHeight
          Preferred height to make the list, this is only used if the the list is layed out horizontally.
protected  java.beans.PropertyChangeListener propertyChangeListener
           
protected static int prototypeCellValueChanged
           
protected  CellRendererPane rendererPane
           
private  int rowsPerColumn
          Number of rows per column.
protected static int selectionModelChanged
           
protected  int updateLayoutStateNeeded
           
private static int widthChanged
           
 
Constructor Summary
BasicListUI()
           
 
Method Summary
private  int convertLocationToColumn(int x, int y)
          Returns the closest column to the passed in location.
private  int convertLocationToModel(int x, int y)
          Returns the closest location to the model index of the passed in location.
private  int convertLocationToRow(int x, int y0, boolean closest)
          Returns the row at location x/y.
private  int convertLocationToRowInColumn(int y, int column)
          Returns the closest row that starts at the specified y-location in the passed in column.
private  int convertModelToColumn(int index)
          Returns the column that the model index index will be displayed in.
private  int convertModelToRow(int index)
          Returns the row that the model index index will be displayed in..
protected  int convertRowToY(int row)
          Return the JList relative Y coordinate of the origin of the specified row or -1 if row isn't valid.
protected  int convertYToRow(int y0)
          Convert the JList relative coordinate to the row that contains it, based on the current layout.
(package private)  ActionMap createActionMap()
           
protected  FocusListener createFocusListener()
           
private  KeyListener createKeyListener()
          Creates an instance of KeyHandler that's added to the JList by installUI().
protected  ListDataListener createListDataListener()
          Creates an instance of ListDataListener that's added to the JLists by model as needed.
protected  ListSelectionListener createListSelectionListener()
          Creates an instance of ListSelectionHandler that's added to the JLists by selectionModel as needed.
protected  MouseInputListener createMouseInputListener()
          Creates a delegate that implements MouseInputListener.
protected  java.beans.PropertyChangeListener createPropertyChangeListener()
          Creates an instance of PropertyChangeHandler that's added to the JList by installUI().
static ComponentUI createUI(JComponent list)
          Returns a new instance of BasicListUI.
(package private)  ActionMap getActionMap()
           
private  Rectangle getCellBounds(JList list, int index)
          Gets the bounds of the specified model index, returning the resulting bounds, or null if index is not valid.
 Rectangle getCellBounds(JList list, int index1, int index2)
          Returns the bounds of the specified item in JList coordinates, null if index isn't valid.
private  int getHeight(int column, int row)
          Returns the height of the cell at the passed in location.
(package private)  InputMap getInputMap(int condition)
           
 Dimension getMaximumSize(JComponent c)
          Returns the specified component's maximum size appropriate for the look and feel.
 Dimension getMinimumSize(JComponent c)
          Returns the specified component's minimum size appropriate for the look and feel.
private  int getModelIndex(int column, int row)
          Returns the model index for the specified display location.
 Dimension getPreferredSize(JComponent c)
          The preferredSize of the list depends upon the layout orientation.
private  int getRowCount(int column)
          Returns the number of rows in the given column.
protected  int getRowHeight(int row)
          Returns the height of the specified row based on the current layout.
 Point indexToLocation(JList list, int index)
          Returns the origin of the specified item in JList coordinates, null if index isn't valid.
protected  void installDefaults()
          Initialize JList properties, e.g. font, foreground, and background, and add the CellRendererPane.
protected  void installKeyboardActions()
          Registers the keyboard bindings on the JList that the BasicListUI is associated with.
protected  void installListeners()
          Create and install the listeners for the JList, its model, and its selectionModel.
 void installUI(JComponent c)
          Initializes this.list by calling installDefaults(), installListeners(), and installKeyboardActions() in order.
 int locationToIndex(JList list, Point location)
          Convert a point in JList coordinates to the closest index of the cell at that location.
protected  void maybeUpdateLayoutState()
          If updateLayoutStateNeeded is non zero, call updateLayoutState() and reset updateLayoutStateNeeded.
 void paint(Graphics g, JComponent c)
          Paint the rows that intersect the Graphics objects clipRect.
protected  void paintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer cellRenderer, ListModel dataModel, ListSelectionModel selModel, int leadIndex)
          Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use the CellRendererPane to paint it.
private  void redrawList()
           
protected  void selectNextIndex()
          Selected the previous row and force it to be visible.
protected  void selectPreviousIndex()
          Selected the previous row and force it to be visible.
protected  void uninstallDefaults()
          Set the JList properties that haven't been explicitly overridden to null.
protected  void uninstallKeyboardActions()
          Unregisters keyboard actions installed from installKeyboardActions.
protected  void uninstallListeners()
          Remove the listeners for the JList, its model, and its selectionModel.
 void uninstallUI(JComponent c)
          Uninitializes this.list by calling uninstallListeners(), uninstallKeyboardActions(), and uninstallDefaults() in order.
private  void updateHorizontalLayoutState(int fixedCellWidth, int fixedCellHeight)
          Invoked when the list is layed out horizontally to determine how many columns to create.
protected  void updateLayoutState()
          Recompute the value of cellHeight or cellHeights based and cellWidth, based on the current font and the current values of fixedCellWidth, fixedCellHeight, and prototypeCellValue.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected JList list

rendererPane

protected CellRendererPane rendererPane

focusListener

protected FocusListener focusListener

mouseInputListener

protected MouseInputListener mouseInputListener

listSelectionListener

protected ListSelectionListener listSelectionListener

listDataListener

protected ListDataListener listDataListener

propertyChangeListener

protected java.beans.PropertyChangeListener propertyChangeListener

keyListener

private KeyListener keyListener

cellHeights

protected int[] cellHeights

cellHeight

protected int cellHeight

cellWidth

protected int cellWidth

updateLayoutStateNeeded

protected int updateLayoutStateNeeded

listHeight

private int listHeight
Height of the list. When asked to paint, if the current size of the list differs, this will update the layout state.


listWidth

private int listWidth
Width of the list. When asked to paint, if the current size of the list differs, this will update the layout state.


layoutOrientation

private int layoutOrientation
The layout orientation of the list.


columnCount

private int columnCount
Number of columns to create.


preferredHeight

private int preferredHeight
Preferred height to make the list, this is only used if the the list is layed out horizontally.


rowsPerColumn

private int rowsPerColumn
Number of rows per column. This is only used if the row height is fixed.


modelChanged

protected static final int modelChanged
See Also:
Constant Field Values

selectionModelChanged

protected static final int selectionModelChanged
See Also:
Constant Field Values

fontChanged

protected static final int fontChanged
See Also:
Constant Field Values

fixedCellWidthChanged

protected static final int fixedCellWidthChanged
See Also:
Constant Field Values

fixedCellHeightChanged

protected static final int fixedCellHeightChanged
See Also:
Constant Field Values

prototypeCellValueChanged

protected static final int prototypeCellValueChanged
See Also:
Constant Field Values

cellRendererChanged

protected static final int cellRendererChanged
See Also:
Constant Field Values

layoutOrientationChanged

private static final int layoutOrientationChanged
See Also:
Constant Field Values

heightChanged

private static final int heightChanged
See Also:
Constant Field Values

widthChanged

private static final int widthChanged
See Also:
Constant Field Values

componentOrientationChanged

private static final int componentOrientationChanged
See Also:
Constant Field Values

CHANGE_LEAD

private static final int CHANGE_LEAD
Used by IncrementLeadSelectionAction. Indicates the action should change the lead, and not select it.

See Also:
Constant Field Values

CHANGE_SELECTION

private static final int CHANGE_SELECTION
Used by IncrementLeadSelectionAction. Indicates the action should change the selection and lead.

See Also:
Constant Field Values

EXTEND_SELECTION

private static final int EXTEND_SELECTION
Used by IncrementLeadSelectionAction. Indicates the action should extend the selection from the anchor to the next index.

See Also:
Constant Field Values

defaultDragRecognizer

private static final BasicListUI.ListDragGestureRecognizer defaultDragRecognizer

defaultTransferHandler

private static final TransferHandler defaultTransferHandler
Constructor Detail

BasicListUI

public BasicListUI()
Method Detail

paintCell

protected void paintCell(Graphics g,
                         int row,
                         Rectangle rowBounds,
                         ListCellRenderer cellRenderer,
                         ListModel dataModel,
                         ListSelectionModel selModel,
                         int leadIndex)
Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use the CellRendererPane to paint it. Subclasses may want to override this method rather than paint().

See Also:
paint(java.awt.Graphics, javax.swing.JComponent)

paint

public void paint(Graphics g,
                  JComponent c)
Paint the rows that intersect the Graphics objects clipRect. This method calls paintCell as necessary. Subclasses may want to override these methods.

Overrides:
paint in class ComponentUI
Parameters:
g - the Graphics context in which to paint
c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
See Also:
paintCell(java.awt.Graphics, int, java.awt.Rectangle, javax.swing.ListCellRenderer, javax.swing.ListModel, javax.swing.ListSelectionModel, int)

getPreferredSize

public Dimension getPreferredSize(JComponent c)
The preferredSize of the list depends upon the layout orientation.
Layout OrientationPreferred Size
JList.VERTICAL The preferredSize of the list is total height of the rows and the maximum width of the cells. If JList.fixedCellHeight is specified then the total height of the rows is just (cellVerticalMargins + fixedCellHeight) * model.getSize() where rowVerticalMargins is the space we allocate for drawing the yellow focus outline. Similarly if fixedCellWidth is specified then we just use that.
JList.VERTICAL_WRAP If the visible row count is greater than zero, the preferredHeight is the maximum cell height * visibleRowCount. If the visible row count is <= 0, the preferred height is either the current height of the list, or the maximum cell height, whichever is bigger. The preferred width is than the maximum cell width * number of columns needed. Where the number of columns needs is list.height / max cell height. Max cell height is either the fixed cell height, or is determined by iterating through all the cells to find the maximum height from the ListCellRenderer.
JList.HORIZONTAL_WRAP If the visible row count is greater than zero, the preferredHeight is the maximum cell height * adjustedRowCount. Where visibleRowCount is used to determine the number of columns. Because this lays out horizontally the number of rows is then determined from the column count. For example, lets say you have a model with 10 items and the visible row count is 8. The number of columns needed to display this is 2, but you no longer need 8 rows to display this, you only need 5, thus the adjustedRowCount is 5.

If the visible row count is <= 0, the preferred height is dictated by the number of columns, which will be as many as can fit in the width of the JList (width / max cell width), with at least one column. The preferred height then becomes the model size / number of columns * maximum cell height. Max cell height is either the fixed cell height, or is determined by iterating through all the cells to find the maximum height from the ListCellRenderer.

The above specifies the raw preferred width and height. The resulting preferred width is the above width + insets.left + insets.right and the resulting preferred height is the above height + insets.top + insets.bottom. Where the Insets are determined from list.getInsets().

Overrides:
getPreferredSize in class ComponentUI
Parameters:
c - The JList component.
Returns:
The total size of the list.
See Also:
JComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Description copied from class: ComponentUI
Returns the specified component's minimum size appropriate for the look and feel. If null is returned, the minimum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.

Overrides:
getMinimumSize in class ComponentUI
Parameters:
c - the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
Returns:
the preferred size
See Also:
getPreferredSize(javax.swing.JComponent)

getMaximumSize

public Dimension getMaximumSize(JComponent c)
Description copied from class: ComponentUI
Returns the specified component's maximum size appropriate for the look and feel. If null is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.

Overrides:
getMaximumSize in class ComponentUI
Parameters:
c - the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
Returns:
the preferred size
See Also:
getPreferredSize(javax.swing.JComponent)

selectPreviousIndex

protected void selectPreviousIndex()
Selected the previous row and force it to be visible.

See Also:
JList.ensureIndexIsVisible(int)

selectNextIndex

protected void selectNextIndex()
Selected the previous row and force it to be visible.

See Also:
JList.ensureIndexIsVisible(int)

installKeyboardActions

protected void installKeyboardActions()
Registers the keyboard bindings on the JList that the BasicListUI is associated with. This method is called at installUI() time.

See Also:
installUI(javax.swing.JComponent)

getInputMap

InputMap getInputMap(int condition)

getActionMap

ActionMap getActionMap()

createActionMap

ActionMap createActionMap()

uninstallKeyboardActions

protected void uninstallKeyboardActions()
Unregisters keyboard actions installed from installKeyboardActions. This method is called at uninstallUI() time - subclassess should ensure that all of the keyboard actions registered at installUI time are removed here.

See Also:
installUI(javax.swing.JComponent)

installListeners

protected void installListeners()
Create and install the listeners for the JList, its model, and its selectionModel. This method is called at installUI() time.

See Also:
installUI(javax.swing.JComponent), uninstallListeners()

uninstallListeners

protected void uninstallListeners()
Remove the listeners for the JList, its model, and its selectionModel. All of the listener fields, are reset to null here. This method is called at uninstallUI() time, it should be kept in sync with installListeners.

See Also:
uninstallUI(javax.swing.JComponent), installListeners()

installDefaults

protected void installDefaults()
Initialize JList properties, e.g. font, foreground, and background, and add the CellRendererPane. The font, foreground, and background properties are only set if their current value is either null or a UIResource, other properties are set if the current value is null.

See Also:
uninstallDefaults(), installUI(javax.swing.JComponent), CellRendererPane

uninstallDefaults

protected void uninstallDefaults()
Set the JList properties that haven't been explicitly overridden to null. A property is considered overridden if its current value is not a UIResource.

See Also:
installDefaults(), uninstallUI(javax.swing.JComponent), CellRendererPane

installUI

public void installUI(JComponent c)
Initializes this.list by calling installDefaults(), installListeners(), and installKeyboardActions() in order.

Overrides:
installUI in class ComponentUI
Parameters:
c - the component where this UI delegate is being installed
See Also:
installDefaults(), installListeners(), installKeyboardActions()

uninstallUI

public void uninstallUI(JComponent c)
Uninitializes this.list by calling uninstallListeners(), uninstallKeyboardActions(), and uninstallDefaults() in order. Sets this.list to null.

Overrides:
uninstallUI in class ComponentUI
Parameters:
c - the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
See Also:
uninstallListeners(), uninstallKeyboardActions(), uninstallDefaults()

createUI

public static ComponentUI createUI(JComponent list)
Returns a new instance of BasicListUI. BasicListUI delegates are allocated one per JList.

Returns:
A new ListUI implementation for the Windows look and feel.

locationToIndex

public int locationToIndex(JList list,
                           Point location)
Convert a point in JList coordinates to the closest index of the cell at that location. To determine if the cell actually contains the specified location use a combination of this method and getCellBounds. Returns -1 if the model is empty.

Specified by:
locationToIndex in class ListUI
Parameters:
location - The JList relative coordinates of the cell
Returns:
The index of the cell at location, or -1.
See Also:
ListUI.locationToIndex(javax.swing.JList, java.awt.Point)

indexToLocation

public Point indexToLocation(JList list,
                             int index)
Description copied from class: ListUI
Returns the origin of the specified item in JList coordinates, null if index isn't valid.

Specified by:
indexToLocation in class ListUI
Parameters:
index - The index of the JList cell.
Returns:
The origin of the index'th cell, null if index is invalid.
See Also:
ListUI.indexToLocation(javax.swing.JList, int)

getCellBounds

public Rectangle getCellBounds(JList list,
                               int index1,
                               int index2)
Description copied from class: ListUI
Returns the bounds of the specified item in JList coordinates, null if index isn't valid.

Specified by:
getCellBounds in class ListUI
Returns:
The bounds of the index'th cell.
See Also:
ListUI.getCellBounds(javax.swing.JList, int, int)

getCellBounds

private Rectangle getCellBounds(JList list,
                                int index)
Gets the bounds of the specified model index, returning the resulting bounds, or null if index is not valid.


getRowHeight

protected int getRowHeight(int row)
Returns the height of the specified row based on the current layout.

Returns:
The specified row height or -1 if row isn't valid.
See Also:
convertYToRow(int), convertRowToY(int), updateLayoutState()

convertYToRow

protected int convertYToRow(int y0)
Convert the JList relative coordinate to the row that contains it, based on the current layout. If y0 doesn't fall within any row, return -1.

Returns:
The row that contains y0, or -1.
See Also:
getRowHeight(int), updateLayoutState()

convertRowToY

protected int convertRowToY(int row)
Return the JList relative Y coordinate of the origin of the specified row or -1 if row isn't valid.

Returns:
The Y coordinate of the origin of row, or -1.
See Also:
getRowHeight(int), updateLayoutState()

getHeight

private int getHeight(int column,
                      int row)
Returns the height of the cell at the passed in location.


convertLocationToRow

private int convertLocationToRow(int x,
                                 int y0,
                                 boolean closest)
Returns the row at location x/y.

Parameters:
closest - If true and the location doesn't exactly match a particular location, this will return the closest row.

convertLocationToRowInColumn

private int convertLocationToRowInColumn(int y,
                                         int column)
Returns the closest row that starts at the specified y-location in the passed in column.


convertLocationToModel

private int convertLocationToModel(int x,
                                   int y)
Returns the closest location to the model index of the passed in location.


getRowCount

private int getRowCount(int column)
Returns the number of rows in the given column.


getModelIndex

private int getModelIndex(int column,
                          int row)
Returns the model index for the specified display location. If columnxrow is beyond the length of the model, this will return the model size - 1.


convertLocationToColumn

private int convertLocationToColumn(int x,
                                    int y)
Returns the closest column to the passed in location.


convertModelToRow

private int convertModelToRow(int index)
Returns the row that the model index index will be displayed in..


convertModelToColumn

private int convertModelToColumn(int index)
Returns the column that the model index index will be displayed in.


maybeUpdateLayoutState

protected void maybeUpdateLayoutState()
If updateLayoutStateNeeded is non zero, call updateLayoutState() and reset updateLayoutStateNeeded. This method should be called by methods before doing any computation based on the geometry of the list. For example it's the first call in paint() and getPreferredSize().

See Also:
updateLayoutState()

updateLayoutState

protected void updateLayoutState()
Recompute the value of cellHeight or cellHeights based and cellWidth, based on the current font and the current values of fixedCellWidth, fixedCellHeight, and prototypeCellValue.

See Also:
maybeUpdateLayoutState()

updateHorizontalLayoutState

private void updateHorizontalLayoutState(int fixedCellWidth,
                                         int fixedCellHeight)
Invoked when the list is layed out horizontally to determine how many columns to create.

This updates the rowsPerColumn, columnCount, preferredHeight and potentially cellHeight instance variables.


createMouseInputListener

protected MouseInputListener createMouseInputListener()
Creates a delegate that implements MouseInputListener. The delegate is added to the corresponding java.awt.Component listener lists at installUI() time. Subclasses can override this method to return a custom MouseInputListener, e.g.
 class MyListUI extends BasicListUI {
    protected MouseInputListener createMouseInputListener() {
        return new MyMouseInputHandler();
    }
    public class MyMouseInputHandler extends MouseInputHandler {
        public void mouseMoved(MouseEvent e) {
            // do some extra work when the mouse moves
            super.mouseMoved(e);
        }
    }
 }
 

See Also:
BasicListUI.MouseInputHandler, installUI(javax.swing.JComponent)

createFocusListener

protected FocusListener createFocusListener()

createListSelectionListener

protected ListSelectionListener createListSelectionListener()
Creates an instance of ListSelectionHandler that's added to the JLists by selectionModel as needed. Subclasses can override this method to return a custom ListSelectionListener, e.g.
 class MyListUI extends BasicListUI {
    protected ListSelectionListener createListSelectionListener() {
        return new MySelectionListener();
    }
    public class MySelectionListener extends ListSelectionHandler {
        public void valueChanged(ListSelectionEvent e) {
            // do some extra work when the selection changes
            super.valueChange(e);
        }
    }
 }
 

See Also:
BasicListUI.ListSelectionHandler, installUI(javax.swing.JComponent)

redrawList

private void redrawList()

createListDataListener

protected ListDataListener createListDataListener()
Creates an instance of ListDataListener that's added to the JLists by model as needed. Subclasses can override this method to return a custom ListDataListener, e.g.
 class MyListUI extends BasicListUI {
    protected ListDataListener createListDataListener() {
        return new MyListDataListener();
    }
    public class MyListDataListener extends ListDataHandler {
        public void contentsChanged(ListDataEvent e) {
            // do some extra work when the models contents change
            super.contentsChange(e);
        }
    }
 }
 

See Also:
ListDataListener, JList.getModel(), installUI(javax.swing.JComponent)

createPropertyChangeListener

protected java.beans.PropertyChangeListener createPropertyChangeListener()
Creates an instance of PropertyChangeHandler that's added to the JList by installUI(). Subclasses can override this method to return a custom PropertyChangeListener, e.g.
 class MyListUI extends BasicListUI {
    protected PropertyChangeListener createPropertyChangeListener() {
        return new MyPropertyChangeListener();
    }
    public class MyPropertyChangeListener extends PropertyChangeHandler {
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName().equals("model")) {
                // do some extra work when the model changes
            }
            super.propertyChange(e);
        }
    }
 }
 

See Also:
PropertyChangeListener, installUI(javax.swing.JComponent)

createKeyListener

private KeyListener createKeyListener()
Creates an instance of KeyHandler that's added to the JList by installUI().