com.alee.laf.list
Class WebListUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ListUI
          extended by javax.swing.plaf.basic.BasicListUI
              extended by com.alee.laf.list.WebListUI

public class WebListUI
extends javax.swing.plaf.basic.BasicListUI

Custom UI for JList component.

Author:
Mikle Garin

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicListUI
javax.swing.plaf.basic.BasicListUI.FocusHandler, javax.swing.plaf.basic.BasicListUI.ListDataHandler, javax.swing.plaf.basic.BasicListUI.ListSelectionHandler, javax.swing.plaf.basic.BasicListUI.MouseInputHandler, javax.swing.plaf.basic.BasicListUI.PropertyChangeHandler
 
Field Summary
 
Fields inherited from class javax.swing.plaf.basic.BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded
 
Constructor Summary
WebListUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebListUI for the specified component.
 int getSelectionRound()
          Returns cells selection rounding.
 int getSelectionShadeWidth()
          Returns cells selection shade width.
 void installUI(javax.swing.JComponent c)
          Installs UI in the specified component.
 boolean isAutoScrollToSelection()
          Returns whether to scroll list down to selection automatically or not.
 boolean isDecorateSelection()
          Returns whether should decorate selected and rollover cells or not.
 boolean isHighlightRolloverCell()
          Returns whether should highlight rollover cell or not.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints list content.
protected  void paintCell(java.awt.Graphics g, int index, java.awt.Rectangle rowBounds, javax.swing.ListCellRenderer cellRenderer, javax.swing.ListModel dataModel, javax.swing.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.
 void setAutoScrollToSelection(boolean autoScrollToSelection)
          Sets whether to scroll list down to selection automatically or not.
 void setDecorateSelection(boolean decorateSelection)
          Sets whether should decorate selected and rollover cells or not.
 void setHighlightRolloverCell(boolean highlightRolloverCell)
          Sets whether should highlight rollover cell or not.
 void setSelectionRound(int selectionRound)
          Sets cells selection rounding.
 void setSelectionShadeWidth(int selectionShadeWidth)
          Sets cells selection shade width.
 void uninstallUI(javax.swing.JComponent c)
          Uninstalls UI from the specified component.
 
Methods inherited from class javax.swing.plaf.basic.BasicListUI
convertRowToY, convertYToRow, createFocusListener, createListDataListener, createListSelectionListener, createMouseInputListener, createPropertyChangeListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installDefaults, installKeyboardActions, installListeners, locationToIndex, maybeUpdateLayoutState, selectNextIndex, selectPreviousIndex, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, updateLayoutState
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebListUI

public WebListUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebListUI for the specified component. This tricky method is used by UIManager to create component UIs when needed.

Parameters:
c - component that will use UI instance
Returns:
instance of the WebListUI

installUI

public void installUI(javax.swing.JComponent c)
Installs UI in the specified component.

Overrides:
installUI in class javax.swing.plaf.basic.BasicListUI
Parameters:
c - component for this UI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component.

Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicListUI
Parameters:
c - component with this UI

isDecorateSelection

public boolean isDecorateSelection()
Returns whether should decorate selected and rollover cells or not.

Returns:
true if should decorate selected and rollover cells, false otherwise

setDecorateSelection

public void setDecorateSelection(boolean decorateSelection)
Sets whether should decorate selected and rollover cells or not.

Parameters:
decorateSelection - whether should decorate selected and rollover cells or not

isHighlightRolloverCell

public boolean isHighlightRolloverCell()
Returns whether should highlight rollover cell or not.

Returns:
true if rollover cell is being highlighted, false otherwise

setHighlightRolloverCell

public void setHighlightRolloverCell(boolean highlightRolloverCell)
Sets whether should highlight rollover cell or not.

Parameters:
highlightRolloverCell - whether should highlight rollover cell or not

getSelectionRound

public int getSelectionRound()
Returns cells selection rounding.

Returns:
cells selection rounding

setSelectionRound

public void setSelectionRound(int selectionRound)
Sets cells selection rounding.

Parameters:
selectionRound - new cells selection rounding

getSelectionShadeWidth

public int getSelectionShadeWidth()
Returns cells selection shade width.

Returns:
cells selection shade width

setSelectionShadeWidth

public void setSelectionShadeWidth(int selectionShadeWidth)
Sets cells selection shade width.

Parameters:
selectionShadeWidth - new cells selection shade width

isAutoScrollToSelection

public boolean isAutoScrollToSelection()
Returns whether to scroll list down to selection automatically or not.

Returns:
true if list is being automatically scrolled to selection, false otherwise

setAutoScrollToSelection

public void setAutoScrollToSelection(boolean autoScrollToSelection)
Sets whether to scroll list down to selection automatically or not.

Parameters:
autoScrollToSelection - whether to scroll list down to selection automatically or not

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints list content.

Overrides:
paint in class javax.swing.plaf.basic.BasicListUI
Parameters:
g - graphics context
c - painted component

paintCell

protected void paintCell(java.awt.Graphics g,
                         int index,
                         java.awt.Rectangle rowBounds,
                         javax.swing.ListCellRenderer cellRenderer,
                         javax.swing.ListModel dataModel,
                         javax.swing.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().

Overrides:
paintCell in class javax.swing.plaf.basic.BasicListUI
Parameters:
g - graphics context
index - cell index
rowBounds - cell bounds
cellRenderer - cell renderer
dataModel - list model
selModel - list selection model
leadIndex - lead cell index
See Also:
paint(java.awt.Graphics, javax.swing.JComponent)