Class ComponentSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,Skin,Visual
- Direct Known Subclasses:
ActivityIndicatorSkin,ButtonSkin,ChartViewSkin,ContainerSkin,GridPaneFillerSkin,ImageViewSkin,LabelSkin,MovieViewSkin,NumberRulerSkin,RulerSkin,SeparatorSkin,TablePaneFillerSkin,TerraGaugeSkin,TerraListViewSkin,TerraMeterSkin,TerraRollupSkin.RollupButtonSkin,TerraScrollBarSkin.HandleSkin,TerraScrollBarSkin.ScrollButtonSkin,TerraScrollPaneCornerSkin,TerraSliderSkin.ThumbSkin,TerraSpinnerSkin.SpinButtonSkin,TerraSpinnerSkin.SpinnerContentSkin,TerraSplitPaneSkin.SplitterShadowSkin,TerraSplitPaneSkin.SplitterSkin,TerraTableViewHeaderSkin,TerraTableViewSkin,TerraTextInputSkin,TerraTreeViewSkin,TextAreaSkin
public abstract class ComponentSkin extends java.lang.Object implements Skin, ComponentListener, ComponentStateListener, ComponentMouseListener, ComponentMouseButtonListener, ComponentMouseWheelListener, ComponentKeyListener, ComponentTooltipListener
Abstract base class for component skins.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description ComponentSkin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.ColorcolorFromObject(java.lang.Object colorValue)Interpret an object as a color value.java.awt.ColorcolorFromObject(java.lang.Object colorValue, boolean allowNull)Interpret an object as a color value.java.awt.ColorcolorFromObject(java.lang.Object colorValue, java.lang.String description)Interpret an object as a color value.java.awt.ColorcolorFromObject(java.lang.Object colorValue, java.lang.String description, boolean allowNull)Interpret an object as a color value.ThemecurrentTheme()Returns the current Theme.voidcursorChanged(Component component, Cursor previousCursor)Called when a component's cursor has changed.static java.awt.FontdecodeFont(java.lang.String value)Interpret a string as a font specification.java.awt.ColordefaultBackgroundColor()Returns the Theme default background color.java.awt.ColordefaultForegroundColor()Returns the Theme default foreground color.voiddragSourceChanged(Component component, DragSource previousDragSource)Called when a component's drag source has changed.voiddropTargetChanged(Component component, DropTarget previousDropTarget)Called when a component's drop target has changed.voidenabledChanged(Component component)Called when a component's enabled state has changed.voidfocusedChanged(Component component, Component obverseComponent)Called when a component's focused state has changed.java.awt.FontfontFromObject(java.lang.Object fontValue)Convert any object we support into its corresponding font.intgetBaseline()Returns the visual's baseline.intgetBaseline(int trialWidth, int trialHeight)Should be implemented in every subclass.java.awt.ColorgetColor(int index)Returns the current theme color indicated by the index value.ComponentgetComponent()Returns the component with which a skin is associated.java.awt.BasicStrokegetFocusRectangleStroke()Returns a dashed line stroke for drawing focus rectangles, based on the current theme setting for "thick" ones.intgetHeight()Returns the visual's height.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.DimensionsgetSize()Default method to return the visual's complete size via aDimensionsobject.TextInputMethodListenergetTextInputMethodListener()Returns the input method listener for this component.java.awt.FontgetThemeFont()Returns the current font setting for the theme.intgetWidth()Returns the visual's width.voidheightLimitsChanged(Component component, int previousMinimumHeight, int previousMaximumHeight)Called when a component's preferred height limits have changed.voidinstall(Component component)Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.protected voidinvalidateComponent()Mark the component's entire size as invalid, to be repainted when the event queue is empty.booleanisFocusable()By default, skins are focusable.booleanisOpaque()By default, skins are assumed to be opaque.booleankeyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)Keyboard handling (Tab key or Shift Tab).booleankeyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)Called when a key has been released.booleankeyTyped(Component component, char character)Called when a key has been typed.voidlocationChanged(Component component, int previousX, int previousY)Called when a component's location has changed.voidmenuHandlerChanged(Component component, MenuHandler previousMenuHandler)Called when a component's context menu handler has changed.booleanmouseClick(Component component, Mouse.Button button, int x, int y, int count)Called when a mouse button is clicked over a component.booleanmouseDown(Component component, Mouse.Button button, int x, int y)Called when a mouse button is pressed over a component.booleanmouseMove(Component component, int x, int y)Called when the mouse is moved over a component.voidmouseOut(Component component)Called when the mouse exits a component.voidmouseOver(Component component)Called when the mouse enters a component.booleanmouseUp(Component component, Mouse.Button button, int x, int y)Called when a mouse button is released over a component.booleanmouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)Called when the mouse wheel is scrolled over a component.voidnameChanged(Component component, java.lang.String previousName)Called when a component's name has changed.voidparentChanged(Component component, Container previousParent)Called when a component's parent has changed (when the component is either added to or removed from a container).voidpreferredSizeChanged(Component component, int previousPreferredWidth, int previousPreferredHeight)Called when a component's preferred size has changed.protected voidrepaintComponent()Repaint the entire component when the event queue is empty.protected voidrepaintComponent(boolean immediate)Repaint the entire component with the option to do so immediately (vs.protected voidrepaintComponent(int x, int y, int areaWidth, int areaHeight)Repaint the area of the component specified by the given location and size when the event queue is empty.protected voidrepaintComponent(int x, int y, int areaWidth, int areaHeight, boolean immediate)Repaint the area of the component specified by the given location and size with the option to do so immediately or when the event queue is empty.protected voidrepaintComponent(Bounds area)Repaint the given area of the component when the event queue is empty.voidsetDefaultStyles()Sets the default styles for this skin by callingTheme.setDefaultStyles(T)with the current skin object.voidsetSize(int newWidth, int newHeight)Set the final size of the component after layout has finished.voidsizeChanged(Component component, int previousWidth, int previousHeight)Called when a component's size has changed.booleanthemeHasThickFocusRectangle()Returns whether the current Theme has thick focus rectangles.booleanthemeHasTransitionEnabled()Returns whether the current Theme has transitions enabled.booleanthemeIsDark()Returns whether the current Theme is dark.booleanthemeIsFlat()Returns whether the current Theme is flat.voidtooltipDelayChanged(Component component, int previousTooltipDelay)Called when a component's tooltip delay has changed.voidtooltipTextChanged(Component component, java.lang.String previousTooltipText)Called when a component's tooltip text has changed.voidtooltipTriggered(Component component, int x, int y)Called when a tooltip has been triggered over a component.voidvisibleChanged(Component component)Called when a component's visible flag has changed.voidwidthLimitsChanged(Component component, int previousMinimumWidth, int previousMaximumWidth)Called when a component's preferred width limits have changed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
getPreferredHeight, getPreferredWidth, setSize
-
-
-
-
Method Detail
-
getWidth
public final int getWidth()
Description copied from interface:VisualReturns the visual's width.
-
getHeight
public final int getHeight()
Description copied from interface:VisualReturns the visual's height.
-
getSize
public final Dimensions getSize()
Description copied from interface:VisualDefault method to return the visual's complete size via aDimensionsobject. Note that if the width and height calculations for a particular object are lengthy and could be better done together rather than separately, that component should be free to override this default implementation.
-
setSize
public void setSize(int newWidth, int newHeight)Set the final size of the component after layout has finished.All subclasses must call this superclass method in order to set the
widthandheightvalues, but may need to do additional calculations before doing so.- Specified by:
setSizein interfaceConstrainedVisual- Parameters:
newWidth- The new (final) width of the component after layout.newHeight- The new (final) height of the component after layout.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)andConstrainedVisual.getPreferredHeight(int).
-
getBaseline
public final int getBaseline()
Description copied from interface:VisualReturns the visual's baseline.- Specified by:
getBaselinein interfaceVisual- Returns:
- The baseline relative to the origin of the visual, or
-1if this visual does not have a baseline.
-
getBaseline
public int getBaseline(int trialWidth, int trialHeight)Should be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaselinein interfaceConstrainedVisual- Parameters:
trialWidth- Constrained width to compute the baseline for.trialHeight- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1if this visual does not have a baseline.
-
install
public void install(Component component)
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.
-
getComponent
public final Component getComponent()
Description copied from interface:SkinReturns the component with which a skin is associated.- Specified by:
getComponentin interfaceSkin- Returns:
- The installed component for this skin instance, set by
install(org.apache.pivot.wtk.Component)(which therefore must be called by every subclass).
-
isFocusable
public boolean isFocusable()
By default, skins are focusable.- Specified by:
isFocusablein interfaceSkin- Returns:
trueif this skin is focusable;false, otherwise.
-
isOpaque
public boolean isOpaque()
By default, skins are assumed to be opaque.
-
parentChanged
public void parentChanged(Component component, Container previousParent)
Description copied from interface:ComponentListenerCalled when a component's parent has changed (when the component is either added to or removed from a container).- Specified by:
parentChangedin interfaceComponentListener- Parameters:
component- The component whose parent changed.previousParent- Previous parent of this component.
-
sizeChanged
public void sizeChanged(Component component, int previousWidth, int previousHeight)
Description copied from interface:ComponentListenerCalled when a component's size has changed.- Specified by:
sizeChangedin interfaceComponentListener- Parameters:
component- Component that changed size.previousWidth- Previous width of this component.previousHeight- Previous height of this component.
-
preferredSizeChanged
public void preferredSizeChanged(Component component, int previousPreferredWidth, int previousPreferredHeight)
Description copied from interface:ComponentListenerCalled when a component's preferred size has changed.- Specified by:
preferredSizeChangedin interfaceComponentListener- Parameters:
component- Component that changed.previousPreferredWidth- Previous value of the preferred width for this component.previousPreferredHeight- Previous preferred height for this component.
-
widthLimitsChanged
public void widthLimitsChanged(Component component, int previousMinimumWidth, int previousMaximumWidth)
Description copied from interface:ComponentListenerCalled when a component's preferred width limits have changed.- Specified by:
widthLimitsChangedin interfaceComponentListener- Parameters:
component- Component that changed.previousMinimumWidth- Previously specified preferred minimum width.previousMaximumWidth- Previous value of the preferred maximum width.
-
heightLimitsChanged
public void heightLimitsChanged(Component component, int previousMinimumHeight, int previousMaximumHeight)
Description copied from interface:ComponentListenerCalled when a component's preferred height limits have changed.- Specified by:
heightLimitsChangedin interfaceComponentListener- Parameters:
component- Component that has changed.previousMinimumHeight- Previously given minimum height value.previousMaximumHeight- Previous maximum height value.
-
locationChanged
public void locationChanged(Component component, int previousX, int previousY)
Description copied from interface:ComponentListenerCalled when a component's location has changed.- Specified by:
locationChangedin interfaceComponentListener- Parameters:
component- Component that has moved.previousX- The previous X position of the component.previousY- The previous Y position.
-
visibleChanged
public void visibleChanged(Component component)
Description copied from interface:ComponentListenerCalled when a component's visible flag has changed.- Specified by:
visibleChangedin interfaceComponentListener- Parameters:
component- Component that has changed visibility.
-
cursorChanged
public void cursorChanged(Component component, Cursor previousCursor)
Description copied from interface:ComponentListenerCalled when a component's cursor has changed.- Specified by:
cursorChangedin interfaceComponentListener- Parameters:
component- Component whose cursor has changed.previousCursor- Previous cursor for this component.
-
tooltipTextChanged
public void tooltipTextChanged(Component component, java.lang.String previousTooltipText)
Description copied from interface:ComponentListenerCalled when a component's tooltip text has changed.- Specified by:
tooltipTextChangedin interfaceComponentListener- Parameters:
component- Component that changed.previousTooltipText- Previous value of this component's tooltip text.
-
tooltipDelayChanged
public void tooltipDelayChanged(Component component, int previousTooltipDelay)
Description copied from interface:ComponentListenerCalled when a component's tooltip delay has changed.- Specified by:
tooltipDelayChangedin interfaceComponentListener- Parameters:
component- The component we're dealing with.previousTooltipDelay- The previous tooltip delay for this component.
-
dragSourceChanged
public void dragSourceChanged(Component component, DragSource previousDragSource)
Description copied from interface:ComponentListenerCalled when a component's drag source has changed.- Specified by:
dragSourceChangedin interfaceComponentListener- Parameters:
component- The component in question.previousDragSource- The previous value of theDragSourcefor this component.
-
dropTargetChanged
public void dropTargetChanged(Component component, DropTarget previousDropTarget)
Description copied from interface:ComponentListenerCalled when a component's drop target has changed.- Specified by:
dropTargetChangedin interfaceComponentListener- Parameters:
component- The component that is changing.previousDropTarget- The previous value of theDropTargetfor this component.
-
menuHandlerChanged
public void menuHandlerChanged(Component component, MenuHandler previousMenuHandler)
Description copied from interface:ComponentListenerCalled when a component's context menu handler has changed.- Specified by:
menuHandlerChangedin interfaceComponentListener- Parameters:
component- The component that has changed.previousMenuHandler- The previous menu handler object for this component.
-
nameChanged
public void nameChanged(Component component, java.lang.String previousName)
Description copied from interface:ComponentListenerCalled when a component's name has changed.- Specified by:
nameChangedin interfaceComponentListener- Parameters:
component- Component whose name changed.previousName- Previous name for this component.
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListenerCalled when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabledflag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()method.- Specified by:
enabledChangedin interfaceComponentStateListener- Parameters:
component- The component whose enabled state is changing.
-
focusedChanged
public void focusedChanged(Component component, Component obverseComponent)
Description copied from interface:ComponentStateListenerCalled when a component's focused state has changed.This will be called both when a component gains focus and when it loses focus. The currently focused component has already been set when this method is called, so that the new state of the component can be determined by calling the
Component.isFocused()method.- Specified by:
focusedChangedin interfaceComponentStateListener- Parameters:
component- The component that is either gaining focus or the one that previously had focus and is now losing it.obverseComponent- If the component is gaining focus, this is the component that is losing focus. If the component is losing focus this is the component that is gaining the focus instead.
-
mouseMove
public boolean mouseMove(Component component, int x, int y)
Description copied from interface:ComponentMouseListenerCalled when the mouse is moved over a component.- Specified by:
mouseMovein interfaceComponentMouseListener- Parameters:
component- Component that is under the mouse.x- X position of the mouse.y- Y position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate (default return).
-
mouseOver
public void mouseOver(Component component)
Description copied from interface:ComponentMouseListenerCalled when the mouse enters a component.Default is to do nothing.
- Specified by:
mouseOverin interfaceComponentMouseListener- Parameters:
component- Component that is now under the mouse pointer.
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListenerCalled when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOutin interfaceComponentMouseListener- Parameters:
component- Component that has now lost the mouse pointer.
-
mouseDown
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is pressed over a component.- Specified by:
mouseDownin interfaceComponentMouseButtonListener- Parameters:
component- Component that is under the mouse pointer.button- Which mouse button was pressed.x- X position of the mouse.y- Y position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is released over a component.- Specified by:
mouseUpin interfaceComponentMouseButtonListener- Parameters:
component- Component user the mouse pointer.button- Which mouse button that was released.x- X position of the mouse.y- Y position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate (default).
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is clicked over a component.- Specified by:
mouseClickin interfaceComponentMouseButtonListener- Parameters:
component- Component user the mouse pointer.button- Which mouse button was clicked.x- X position of the mouse.y- Y position of the mouse.count- Number of clicks (1 = single click, 2 = double click, etc.).- Returns:
trueto consume the event;falseto allow it to propagate (default).
-
mouseWheel
public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Description copied from interface:ComponentMouseWheelListenerCalled when the mouse wheel is scrolled over a component.- Specified by:
mouseWheelin interfaceComponentMouseWheelListener- Parameters:
component- Component under the mouse pointer.scrollType- What type of scroll was requested on the mouse.scrollAmount- Amount of scrolling.wheelRotation- Rotation value.x- X position of the mouse.y- Y position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate.
-
keyTyped
public boolean keyTyped(Component component, char character)
Description copied from interface:ComponentKeyListenerCalled when a key has been typed.- Specified by:
keyTypedin interfaceComponentKeyListener- Parameters:
component- Component that has the focus, that is receiving this key.character- The decoded character that was typed.- Returns:
trueto consume the event;falseto allow it to propagate.
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Keyboard handling (Tab key or Shift Tab).- Specified by:
keyPressedin interfaceComponentKeyListener- Parameters:
component- Component that has the focus.keyCode- The key code for the key that was pressed.keyLocation- Location value for the key (left or right for shift keys, etc.).- Returns:
trueto consume the event;falseto allow it to propagate.
-
keyReleased
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Description copied from interface:ComponentKeyListenerCalled when a key has been released.- Specified by:
keyReleasedin interfaceComponentKeyListener- Parameters:
component- Component that has the focus, that is receiving this key event.keyCode- Code for the key that was released.keyLocation- Location of the key.- Returns:
trueto consume the event;falseto allow it to propagate.
-
tooltipTriggered
public void tooltipTriggered(Component component, int x, int y)
Description copied from interface:ComponentTooltipListenerCalled when a tooltip has been triggered over a component.- Specified by:
tooltipTriggeredin interfaceComponentTooltipListener- Parameters:
component- The component in question.x- X position of the mouse.y- Y position of the mouse.
-
invalidateComponent
protected void invalidateComponent()
Mark the component's entire size as invalid, to be repainted when the event queue is empty.
-
repaintComponent
protected void repaintComponent()
Repaint the entire component when the event queue is empty.
-
repaintComponent
protected void repaintComponent(boolean immediate)
Repaint the entire component with the option to do so immediately (vs. when the event queue is empty).- Parameters:
immediate-trueto repaint the entire component now.
-
repaintComponent
protected void repaintComponent(Bounds area)
Repaint the given area of the component when the event queue is empty.- Parameters:
area- The bounding box of the area to be repainted.
-
repaintComponent
protected void repaintComponent(int x, int y, int areaWidth, int areaHeight)Repaint the area of the component specified by the given location and size when the event queue is empty.- Parameters:
x- The starting X-position to paint.y- The starting Y-position to paint.areaWidth- The width of the area to repaint.areaHeight- The height of the area to repaint.
-
repaintComponent
protected void repaintComponent(int x, int y, int areaWidth, int areaHeight, boolean immediate)Repaint the area of the component specified by the given location and size with the option to do so immediately or when the event queue is empty.- Parameters:
x- The starting X-position to paint.y- The starting Y-position to paint.areaWidth- The width of the area to repaint.areaHeight- The height of the area to repaint.immediate-trueto repaint the given area now.
-
decodeFont
public static final java.awt.Font decodeFont(java.lang.String value)
Interpret a string as a font specification.- Parameters:
value- Either a JSON dictionarydescribing a font relative to the current theme, or one of thestandard Java font specifications, with the additional capability of supplying a list of font names (comma-separated) (similar to CSS) if desired.- Returns:
- The font corresponding to the specification.
- Throws:
java.lang.IllegalArgumentException- if the given string isnullor empty or the font specification cannot be decoded.- See Also:
FontUtilities.decodeFont(String)
-
fontFromObject
public java.awt.Font fontFromObject(java.lang.Object fontValue)
Convert any object we support into its corresponding font.Uses
FontUtilities.decodeFont(java.lang.String)orTheme.deriveFont(org.apache.pivot.collections.Dictionary<java.lang.String, ?>)to do the work.- Parameters:
fontValue- The object to be converted to a font.- Returns:
- The converted font.
- Throws:
java.lang.IllegalArgumentException- if the value isnullor cannot be converted.- See Also:
FontUtilities.fromObject(java.lang.Object)
-
currentTheme
public final Theme currentTheme()
Returns the current Theme.- Returns:
- The currently loaded theme.
-
themeIsDark
public final boolean themeIsDark()
Returns whether the current Theme is dark. Usually this means that (if true) any color will be transformed in the opposite way.- Returns:
trueif it is dark,falseotherwise (default)
-
themeIsFlat
public final boolean themeIsFlat()
Returns whether the current Theme is flat. Note that flat themes usually have no bevel, gradients, shadow effects, and in some cases even no borders.- Returns:
trueif it is flat,falseotherwise (default)
-
themeHasTransitionEnabled
public final boolean themeHasTransitionEnabled()
Returns whether the current Theme has transitions enabled.- Returns:
trueif transitions are enabled (default),falseotherwise
-
themeHasThickFocusRectangle
public final boolean themeHasThickFocusRectangle()
Returns whether the current Theme has thick focus rectangles.- Returns:
trueif thick focus rectangles are drawn (new default), orfalseotherwise (default for previous versions).
-
defaultBackgroundColor
public final java.awt.Color defaultBackgroundColor()
Returns the Theme default background color.- Returns:
Color.WHITEif the theme is not dark (default), orColor.BLACK.
-
defaultForegroundColor
public final java.awt.Color defaultForegroundColor()
Returns the Theme default foreground color.- Returns:
Color.BLACKif the theme is not dark (default), orColor.WHITE.
-
getFocusRectangleStroke
public final java.awt.BasicStroke getFocusRectangleStroke()
Returns a dashed line stroke for drawing focus rectangles, based on the current theme setting for "thick" ones.- Returns:
- A line stroke object with the correct thickness and dash pattern.
-
getColor
public final java.awt.Color getColor(int index)
Returns the current theme color indicated by the index value.- Parameters:
index- Index into the theme's color palette.- Returns:
- The current theme color value.
-
colorFromObject
public final java.awt.Color colorFromObject(java.lang.Object colorValue)
Interpret an object as a color value.- Parameters:
colorValue- One of aString(interpreted byGraphicsUtilities.decodeColor(String,String)), a straightColor, one of ourCSSColorvalues, or an integer index into the theme's color palette.- Returns:
- The real
Colorvalue. - Throws:
java.lang.IllegalArgumentException- if thecolorValueisnullor of a type we don't recognize.- See Also:
ColorUtilities.fromObject(java.lang.Object, java.lang.String, boolean)
-
colorFromObject
public final java.awt.Color colorFromObject(java.lang.Object colorValue, boolean allowNull)Interpret an object as a color value.- Parameters:
colorValue- One of aString(interpreted byGraphicsUtilities.decodeColor(String,String)), a straightColor, one of ourCSSColorvalues, or an integer index into the theme's color palette.allowNull- Whether or not to allow a null color.- Returns:
- The real
Colorvalue. - Throws:
java.lang.IllegalArgumentException- if thecolorValueisnull(unlessallowNullistrue), or of a type we don't recognize.- See Also:
ColorUtilities.fromObject(java.lang.Object, java.lang.String, boolean)
-
colorFromObject
public final java.awt.Color colorFromObject(java.lang.Object colorValue, java.lang.String description)Interpret an object as a color value.- Parameters:
colorValue- One of aString(interpreted byGraphicsUtilities.decodeColor(String,String)), a straightColor, one of ourCSSColorvalues, or an integer index into the theme's color palette.description- An optional description for the call toUtils.checkNull(java.lang.Object, java.lang.String)in case of a null input value.- Returns:
- The real
Colorvalue. - Throws:
java.lang.IllegalArgumentException- if thecolorValueisnull, or of a type we don't recognize.- See Also:
ColorUtilities.fromObject(java.lang.Object, java.lang.String, boolean)
-
colorFromObject
public final java.awt.Color colorFromObject(java.lang.Object colorValue, java.lang.String description, boolean allowNull)Interpret an object as a color value.- Parameters:
colorValue- One of aString(interpreted byGraphicsUtilities.decodeColor(String,String)), a straightColor, one of ourCSSColorvalues, or an integer index into the theme's color palette.description- An optional description for the call toUtils.checkNull(java.lang.Object, java.lang.String)in case of a null input value.allowNull- Whether or not to allow a null color.- Returns:
- The real
Colorvalue. - Throws:
java.lang.IllegalArgumentException- if thecolorValueisnull(unlessallowNullistrue), or of a type we don't recognize.- See Also:
ColorUtilities.fromObject(java.lang.Object, java.lang.String, boolean)
-
getThemeFont
public final java.awt.Font getThemeFont()
Returns the current font setting for the theme.- Returns:
- The default font for the theme.
-
setDefaultStyles
public final void setDefaultStyles()
Sets the default styles for this skin by callingTheme.setDefaultStyles(T)with the current skin object.
-
getTextInputMethodListener
public TextInputMethodListener getTextInputMethodListener()
Returns the input method listener for this component.Should be overridden by any component's skin that wants to handle Input Method events (such as
TextInput).- Returns:
- The input method listener (if any) for this component.
-
-