Class SynthComboBoxUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ComboBoxUI
javax.swing.plaf.basic.BasicComboBoxUI
javax.swing.plaf.synth.SynthComboBoxUI
- All Implemented Interfaces:
PropertyChangeListener, EventListener, SynthConstants, SynthUI
Provides the Synth L&F UI delegate for
JComboBox.- Since:
- 1.7
-
Nested Class Summary
Nested classes/interfaces declared in class BasicComboBoxUI
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandlerModifier and TypeClassDescriptionclassThis layout manager handles the 'standard' layout of combo boxes.classThis listener hides the popup when the focus is lost.classThis listener watches for changes to the selection in the combo box.classThis listener checks to see if the key event isn't a navigation key.classThis listener watches for changes in theComboBoxModel.classThis listener watches for bound properties that have changed in the combo box. -
Field Summary
Fields declared in class BasicComboBoxUI
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, padding, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener, squareButtonModifier and TypeFieldDescriptionprotected JButtonThe arrow button that invokes the popup.protected DimensionThe cached minimum preferred size.The instance ofJComboBox.protected CellRendererPaneUsed to render the currently selected item in the combo box.protected ComponentThe Component that theComboBoxEditoruses for editing.protected FocusListenerThis protected field is implementation specific.protected booleanThis protected field is implementation specific.protected booleanThe flag for recalculating the minimum preferred size.protected ItemListenerThis protected field is implementation specific.protected KeyListenerThis protected field is implementation specific.This list is for drawing the current item in the combo box.protected ListDataListenerThis protected field is implementation specific.protected InsetsIf specified, these insets act as padding around the cell renderer when laying out and painting the "selected" item in the combo box.protected ComboPopupThe implementation ofComboPopupthat is used to show the popup.protected KeyListenerTheKeyListenerlistens to events.protected MouseListenerTheMouseListenerlistens to events.protected MouseMotionListenerTheMouseMotionListenerlistens to events.protected PropertyChangeListenerThis protected field is implementation specific.protected booleanIndicates whether or not the combo box button should be square.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 ComponentUICreates a new UI object for the given component.Returns the Context for the specified component.protected DimensionReturns the default size of an empty display area of the combo box using the current renderer and font.The minimum size is the size of the display area plus insets plus the button.voidConfigures the specified component appropriately for the look and feel.voidpaint(Graphics g, JComponent c) Paints the specified component according to the Look and Feel.protected voidpaint(SynthContext context, Graphics g) Paints the specified component.voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.voidpaintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) Paints the currently selected item.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 BasicComboBoxUI
addEditor, configureArrowButton, configureEditor, createArrowButton, createEditor, createFocusListener, createItemListener, createKeyListener, createLayoutManager, createListDataListener, createPopup, createPropertyChangeListener, createRenderer, getBaseline, getBaselineResizeBehavior, getDisplaySize, getInsets, getSizeForComponent, installComponents, installDefaults, installKeyboardActions, installListeners, isFocusTraversable, isNavigationKey, isPopupVisible, paintCurrentValueBackground, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, unconfigureEditor, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListenersModifier and TypeMethodDescriptionvoidThis public method is implementation specific and should be private. do not call or override.voidThis public method is implementation specific and should be private.protected voidThis protected method is implementation specific and should be private. do not call or override.protected JButtonCreates a button which will be used as the control to show or hide the popup portion of the combo box.protected ComboBoxEditorCreates the default editor that will be used in editable combo boxes.protected FocusListenerCreates aFocusListenerwhich will be added to the combo box.protected ItemListenerCreates anItemListenerwhich will be added to the combo box.protected KeyListenerCreates aKeyListenerwhich will be added to the combo box.protected LayoutManagerCreates a layout manager for managing the components which make up the combo box.protected ListDataListenerCreates a list data listener which will be added to theComboBoxModel.protected ComboPopupCreates the popup portion of the combo box.protected PropertyChangeListenerCreates aPropertyChangeListenerwhich will be added to the combo box.protected ListCellRenderer<Object> Creates the default renderer that will be used in a non-editiable combo box.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.protected DimensionReturns the calculated size of the display area.protected InsetsGets the insets from the JComboBox.protected DimensiongetSizeForComponent(Component comp) Returns the size a component would have if used as a cell renderer.protected voidCreates and initializes the components which make up the aggregate combo box.protected voidInstalls the default colors, default font, default renderer, and default editor into the JComboBox.protected voidAdds keyboard actions to the JComboBox.protected voidCreates and installs listeners for the combo box and its model.booleanisFocusTraversable(JComboBox<?> c) Determines if the JComboBox is focus traversable.protected booleanisNavigationKey(int keyCode) Returns whether or not the supplied keyCode maps to a key that is used for navigation.booleanisPopupVisible(JComboBox<?> c) Tells if the popup is visible or not.voidpaintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus) Paints the background of the currently selected item.protected RectangleReturns the area that is reserved for drawing the currently selected item.voidThis public method is implementation specific and should be private. do not call or override.protected voidSelects the next item in the list.protected voidSelects the previous item in the list.voidsetPopupVisible(JComboBox<?> c, boolean v) Hides the popup.protected voidHides the popup if it is showing and shows the popup if it is hidden.voidThis public method is implementation specific and should be private.protected voidThis protected method is implementation specific and should be private.protected voidThe aggregate components which comprise the combo box are unregistered and uninitialized.protected voidUninstalls the default colors, default font, default renderer, and default editor from the combo box.protected voidRemoves the focus InputMap and ActionMap.protected voidRemoves the installed listeners from the combo box and its model.Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getPreferredSize, uninstallUIModifier 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 preferred size appropriate for the look and feel.voidReverses configuration which was done on the specified component duringinstallUI.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
-
SynthComboBoxUI
public SynthComboBoxUI()Constructs aSynthComboBoxUI.
-
-
Method Details
-
createUI
Creates a new UI object for the given component.- Parameters:
c- component to create UI object for- Returns:
- the UI object
-
installUI
Configures the specified component appropriately for the look and feel. This method is invoked when theComponentUIinstance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:- Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
- Install a
LayoutManageron the component if necessary. - Create/add any required sub-components to the component.
- Create/install event listeners on the component.
- Create/install a
PropertyChangeListeneron the component in order to detect and respond to component property changes appropriately. - Install keyboard UI (mnemonics, traversal, etc.) on the component.
- Initialize any appropriate instance data.
- Overrides:
installUIin classComponentUI- Parameters:
c- the component where this UI delegate is being installed- See Also:
-
getContext
Returns the Context for the specified component.- Specified by:
getContextin interfaceSynthUI- Parameters:
c- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-
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.
-
update
Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls thepaint(SynthContext,Graphics)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:
-
getMinimumSize
The minimum size is the size of the display area plus insets plus the button.- Overrides:
getMinimumSizein classBasicComboBoxUI- 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:
- a
Dimensionobject ornull - See Also:
-
paint
Paints the specified component according to the Look and Feel.This method is not used by Synth Look and Feel. Painting is handled by the
paint(SynthContext,Graphics)method.- Overrides:
paintin classComponentUI- Parameters:
g- theGraphicsobject used for paintingc- the component being painted- See Also:
-
paint
Paints the specified component.- Parameters:
context- context for the component being paintedg- theGraphicsobject used for painting- 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
-
paintCurrentValue
Paints the currently selected item.- Overrides:
paintCurrentValuein classBasicComboBoxUI- Parameters:
g- an instance ofGraphicsbounds- a bounding rectangle to render tohasFocus- is focused
-
getDefaultSize
Returns the default size of an empty display area of the combo box using the current renderer and font. This method was overridden to use SynthComboBoxRenderer instead of DefaultListCellRenderer as the default renderer when calculating the size of the combo box. This is used in the case of the combo not having any data.- Overrides:
getDefaultSizein classBasicComboBoxUI- Returns:
- the size of an empty display area
- See Also:
-