Class SynthListUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ListUI
javax.swing.plaf.basic.BasicListUI
javax.swing.plaf.synth.SynthListUI
- All Implemented Interfaces:
PropertyChangeListener, EventListener, SynthConstants, SynthUI
Provides the Synth L&F UI delegate for
JList
.- Since:
- 1.7
-
Nested Class Summary
Nested classes/interfaces declared in class BasicListUI
BasicListUI.FocusHandler, BasicListUI.ListDataHandler, BasicListUI.ListSelectionHandler, BasicListUI.MouseInputHandler, BasicListUI.PropertyChangeHandler
Modifier and TypeClassDescriptionclass
This class should be treated as a "protected" inner class.class
TheListDataListener
that's added to theJLists
model atinstallUI time
, and whenever the JList.model property changes.class
The ListSelectionListener that's added to the JLists selection model at installUI time, and whenever the JList.selectionModel property changes.class
Mouse input, and focus handling for JList.class
The PropertyChangeListener that's added to the JList at installUI time. -
Field Summary
Fields declared in class BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded
Modifier and TypeFieldDescriptionprotected int
The height of cell.protected int[]
The array of cells' heightprotected static final int
The bit relates to cell renderer changed property.protected int
The width of cell.protected static final int
The bit relates to fixed cell height changed property.protected static final int
The bit relates to fixed cell width changed property.protected FocusListener
FocusListener
that attached toJList
.protected static final int
The bit relates to font changed property.The instance ofJList
.protected ListDataListener
ListDataListener
that attached toJList
.protected ListSelectionListener
ListSelectionListener
that attached toJList
.protected static final int
The bit relates to model changed property.protected MouseInputListener
MouseInputListener
that attached toJList
.protected PropertyChangeListener
PropertyChangeListener
that attached toJList
.protected static final int
The bit relates to prototype cell value changed property.protected CellRendererPane
The instance ofCellRendererPane
.protected static final int
The bit relates to selection model changed property.protected int
The value represents changes toJList
model.Fields declared in interface SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
Modifier and TypeFieldDescriptionstatic final int
Indicates the region is the default.static final int
Primary state indicating the region is not enabled.static final int
Primary state indicating the component is enabled.static final int
Indicates the region has focus.static final int
Primary state indicating the mouse is over the region.static final int
Primary state indicating the region is in a pressed state.static final int
Indicates the region is selected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUI
createUI
(JComponent list) Creates a new UI object for the given component.Returns the Context for the specified component.void
paintBorder
(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.void
This method gets called when a bound property is changed.void
update
(Graphics g, JComponent c) Notifies this UI delegate to repaint the specified component.Methods declared in class BasicListUI
convertRowToY, convertYToRow, createFocusListener, createListDataListener, createListSelectionListener, createMouseInputListener, createPropertyChangeListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installDefaults, installKeyboardActions, installListeners, installUI, locationToIndex, maybeUpdateLayoutState, paint, paintCell, selectNextIndex, selectPreviousIndex, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateLayoutState
Modifier and TypeMethodDescriptionprotected int
convertRowToY
(int row) Return theJList
relative Y coordinate of the origin of the specified row or -1 if row isn't valid.protected int
convertYToRow
(int y0) Convert theJList
relative coordinate to the row that contains it, based on the current layout.protected FocusListener
Returns an instance ofFocusListener
.protected ListDataListener
Creates an instance ofListDataListener
that's added to theJLists
by model as needed.protected ListSelectionListener
Creates an instance ofListSelectionHandler
that's added to theJLists
by selectionModel as needed.protected MouseInputListener
Creates a delegate that implementsMouseInputListener
.protected PropertyChangeListener
Creates an instance ofPropertyChangeHandler
that's added to theJList
byinstallUI()
.int
getBaseline
(JComponent c, int width, int height) Returns the baseline.Returns an enum indicating how the baseline of the component changes as the size changes.getCellBounds
(JList<?> list, int index1, int index2) Returns the bounding rectangle, in the given list's coordinate system, for the range of cells specified by the two indices.The preferredSize of the list depends upon the layout orientation.protected int
getRowHeight
(int row) Returns the height of the specified row based on the current layout.indexToLocation
(JList<?> list, int index) Returns the origin in the givenJList
, of the specified item, in the list's coordinate system.protected void
Initializes list properties such as font, foreground, and background, and adds the CellRendererPane.protected void
Registers the keyboard bindings on theJList
that theBasicListUI
is associated with.protected void
Creates and installs the listeners for the JList, its model, and its selectionModel.void
Initializesthis.list
by callinginstallDefaults()
,installListeners()
, andinstallKeyboardActions()
in order.int
locationToIndex
(JList<?> list, Point location) Returns the cell index in the specifiedJList
closest to the given location in the list's coordinate system.protected void
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<Object> cellRenderer, ListModel<Object> dataModel, ListSelectionModel selModel, int leadIndex) Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use theCellRendererPane
to paint it.protected void
Selected the previous row and force it to be visible.protected void
Selected the previous row and force it to be visible.protected void
Sets the list properties that have not been explicitly overridden tonull
.protected void
Unregisters keyboard actions installed frominstallKeyboardActions
.protected void
Removes the listeners from the JList, its model, and its selectionModel.void
Uninitializesthis.list
by callinguninstallListeners()
,uninstallKeyboardActions()
, anduninstallDefaults()
in order.protected void
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 declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize
Modifier and TypeMethodDescriptionboolean
contains
(JComponent c, int x, int y) Returnstrue
if the specified x,y location is contained within the look and feel's defined shape of the specified component.getAccessibleChild
(JComponent c, int i) Returns thei
thAccessible
child of the object.int
Returns the number of accessible children in the object.Returns the specified component's maximum size appropriate for the look and feel.Returns the specified component's minimum size appropriate for the look and feel.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
SynthListUI
public SynthListUI()Constructs aSynthListUI
.
-
-
Method Details
-
createUI
Creates a new UI object for the given component.- Parameters:
list
- component to create UI object for- Returns:
- the UI object
-
update
Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls theBasicListUI.paint(Graphics, JComponent)
method.In general, this method does not need to be overridden by subclasses. All Look and Feel rendering code should reside in the
paint
method.- Overrides:
update
in classComponentUI
- Parameters:
g
- theGraphics
object used for paintingc
- the component being painted- See Also:
-
paintBorder
Paints the border.- Specified by:
paintBorder
in interfaceSynthUI
- Parameters:
context
- a component contextg
-Graphics
to paint onx
- the X coordinatey
- the Y coordinatew
- width of the borderh
- height of the border
-
propertyChange
This method gets called when a bound property is changed.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
e
- A PropertyChangeEvent object describing the event source and the property that has changed.
-
getContext
Returns the Context for the specified component.- Specified by:
getContext
in interfaceSynthUI
- Parameters:
c
- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-