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.PropertyChangeHandlerModifier and TypeClassDescriptionclassThis class should be treated as a "protected" inner class.classTheListDataListenerthat's added to theJListsmodel atinstallUI time, and whenever the JList.model property changes.classThe ListSelectionListener that's added to the JLists selection model at installUI time, and whenever the JList.selectionModel property changes.classMouse input, and focus handling for JList.classThe 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, updateLayoutStateNeededModifier and TypeFieldDescriptionprotected intThe height of cell.protected int[]The array of cells' heightprotected static final intThe bit relates to cell renderer changed property.protected intThe width of cell.protected static final intThe bit relates to fixed cell height changed property.protected static final intThe bit relates to fixed cell width changed property.protected FocusListenerFocusListenerthat attached toJList.protected static final intThe bit relates to font changed property.The instance ofJList.protected ListDataListenerListDataListenerthat attached toJList.protected ListSelectionListenerListSelectionListenerthat attached toJList.protected static final intThe bit relates to model changed property.protected MouseInputListenerMouseInputListenerthat attached toJList.protected PropertyChangeListenerPropertyChangeListenerthat attached toJList.protected static final intThe bit relates to prototype cell value changed property.protected CellRendererPaneThe instance ofCellRendererPane.protected static final intThe bit relates to selection model changed property.protected intThe value represents changes toJListmodel.Fields declared in interface SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTEDModifier and TypeFieldDescriptionstatic final intIndicates the region is the default.static final intPrimary state indicating the region is not enabled.static final intPrimary state indicating the component is enabled.static final intIndicates the region has focus.static final intPrimary state indicating the mouse is over the region.static final intPrimary state indicating the region is in a pressed state.static final intIndicates the region is selected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUIcreateUI(JComponent list) Creates a new UI object for the given component.Returns the Context for the specified component.voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.voidThis method gets called when a bound property is changed.voidupdate(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, updateLayoutStateModifier and TypeMethodDescriptionprotected intconvertRowToY(int row) Return theJListrelative Y coordinate of the origin of the specified row or -1 if row isn't valid.protected intconvertYToRow(int y0) Convert theJListrelative coordinate to the row that contains it, based on the current layout.protected FocusListenerReturns an instance ofFocusListener.protected ListDataListenerCreates an instance ofListDataListenerthat's added to theJListsby model as needed.protected ListSelectionListenerCreates an instance ofListSelectionHandlerthat's added to theJListsby selectionModel as needed.protected MouseInputListenerCreates a delegate that implementsMouseInputListener.protected PropertyChangeListenerCreates an instance ofPropertyChangeHandlerthat's added to theJListbyinstallUI().intgetBaseline(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 intgetRowHeight(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 voidInitializes list properties such as font, foreground, and background, and adds the CellRendererPane.protected voidRegisters the keyboard bindings on theJListthat theBasicListUIis associated with.protected voidCreates and installs the listeners for the JList, its model, and its selectionModel.voidInitializesthis.listby callinginstallDefaults(),installListeners(), andinstallKeyboardActions()in order.intlocationToIndex(JList<?> list, Point location) Returns the cell index in the specifiedJListclosest to the given location in the list's coordinate system.protected voidIf updateLayoutStateNeeded is non zero, call updateLayoutState() and reset updateLayoutStateNeeded.voidpaint(Graphics g, JComponent c) Paint the rows that intersect the Graphics objects clipRect.protected voidpaintCell(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 theCellRendererPaneto paint it.protected voidSelected the previous row and force it to be visible.protected voidSelected the previous row and force it to be visible.protected voidSets the list properties that have not been explicitly overridden tonull.protected voidUnregisters keyboard actions installed frominstallKeyboardActions.protected voidRemoves the listeners from the JList, its model, and its selectionModel.voidUninitializesthis.listby callinguninstallListeners(),uninstallKeyboardActions(), anduninstallDefaults()in order.protected voidRecompute 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, getMinimumSizeModifier and TypeMethodDescriptionbooleancontains(JComponent c, int x, int y) Returnstrueif 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 theithAccessiblechild of the object.intReturns 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, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()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.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(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 voidwait(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
paintmethod.- Overrides:
updatein classComponentUI- Parameters:
g- theGraphicsobject used for paintingc- the component being painted- See Also:
-
paintBorder
Paints the border.- Specified by:
paintBorderin interfaceSynthUI- Parameters:
context- a component contextg-Graphicsto 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:
propertyChangein 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:
getContextin interfaceSynthUI- Parameters:
c- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-