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.Color
colorFromObject(java.lang.Object colorValue)
Interpret an object as a color value.java.awt.Color
colorFromObject(java.lang.Object colorValue, boolean allowNull)
Interpret an object as a color value.java.awt.Color
colorFromObject(java.lang.Object colorValue, java.lang.String description)
Interpret an object as a color value.java.awt.Color
colorFromObject(java.lang.Object colorValue, java.lang.String description, boolean allowNull)
Interpret an object as a color value.Theme
currentTheme()
Returns the current Theme.void
cursorChanged(Component component, Cursor previousCursor)
Called when a component's cursor has changed.static java.awt.Font
decodeFont(java.lang.String value)
Interpret a string as a font specification.java.awt.Color
defaultBackgroundColor()
Returns the Theme default background color.java.awt.Color
defaultForegroundColor()
Returns the Theme default foreground color.void
dragSourceChanged(Component component, DragSource previousDragSource)
Called when a component's drag source has changed.void
dropTargetChanged(Component component, DropTarget previousDropTarget)
Called when a component's drop target has changed.void
enabledChanged(Component component)
Called when a component's enabled state has changed.void
focusedChanged(Component component, Component obverseComponent)
Called when a component's focused state has changed.java.awt.Font
fontFromObject(java.lang.Object fontValue)
Convert any object we support into its corresponding font.int
getBaseline()
Returns the visual's baseline.int
getBaseline(int trialWidth, int trialHeight)
Should be implemented in every subclass.java.awt.Color
getColor(int index)
Returns the current theme color indicated by the index value.Component
getComponent()
Returns the component with which a skin is associated.java.awt.BasicStroke
getFocusRectangleStroke()
Returns a dashed line stroke for drawing focus rectangles, based on the current theme setting for "thick" ones.int
getHeight()
Returns the visual's height.Dimensions
getPreferredSize()
Returns the visual's unconstrained preferred size.Dimensions
getSize()
Default method to return the visual's complete size via aDimensions
object.TextInputMethodListener
getTextInputMethodListener()
Returns the input method listener for this component.java.awt.Font
getThemeFont()
Returns the current font setting for the theme.int
getWidth()
Returns the visual's width.void
heightLimitsChanged(Component component, int previousMinimumHeight, int previousMaximumHeight)
Called when a component's preferred height limits have changed.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.protected void
invalidateComponent()
Mark the component's entire size as invalid, to be repainted when the event queue is empty.boolean
isFocusable()
By default, skins are focusable.boolean
isOpaque()
By default, skins are assumed to be opaque.boolean
keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Keyboard handling (Tab key or Shift Tab).boolean
keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Called when a key has been released.boolean
keyTyped(Component component, char character)
Called when a key has been typed.void
locationChanged(Component component, int previousX, int previousY)
Called when a component's location has changed.void
menuHandlerChanged(Component component, MenuHandler previousMenuHandler)
Called when a component's context menu handler has changed.boolean
mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Called when a mouse button is clicked over a component.boolean
mouseDown(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is pressed over a component.boolean
mouseMove(Component component, int x, int y)
Called when the mouse is moved over a component.void
mouseOut(Component component)
Called when the mouse exits a component.void
mouseOver(Component component)
Called when the mouse enters a component.boolean
mouseUp(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is released over a component.boolean
mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Called when the mouse wheel is scrolled over a component.void
nameChanged(Component component, java.lang.String previousName)
Called when a component's name has changed.void
parentChanged(Component component, Container previousParent)
Called when a component's parent has changed (when the component is either added to or removed from a container).void
preferredSizeChanged(Component component, int previousPreferredWidth, int previousPreferredHeight)
Called when a component's preferred size has changed.protected void
repaintComponent()
Repaint the entire component when the event queue is empty.protected void
repaintComponent(boolean immediate)
Repaint the entire component with the option to do so immediately (vs.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.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.protected void
repaintComponent(Bounds area)
Repaint the given area of the component when the event queue is empty.void
setDefaultStyles()
Sets the default styles for this skin by callingTheme.setDefaultStyles(T)
with the current skin object.void
setSize(int newWidth, int newHeight)
Set the final size of the component after layout has finished.void
sizeChanged(Component component, int previousWidth, int previousHeight)
Called when a component's size has changed.boolean
themeHasThickFocusRectangle()
Returns whether the current Theme has thick focus rectangles.boolean
themeHasTransitionEnabled()
Returns whether the current Theme has transitions enabled.boolean
themeIsDark()
Returns whether the current Theme is dark.boolean
themeIsFlat()
Returns whether the current Theme is flat.void
tooltipDelayChanged(Component component, int previousTooltipDelay)
Called when a component's tooltip delay has changed.void
tooltipTextChanged(Component component, java.lang.String previousTooltipText)
Called when a component's tooltip text has changed.void
tooltipTriggered(Component component, int x, int y)
Called when a tooltip has been triggered over a component.void
visibleChanged(Component component)
Called when a component's visible flag has changed.void
widthLimitsChanged(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:Visual
Returns the visual's width.
-
getHeight
public final int getHeight()
Description copied from interface:Visual
Returns the visual's height.
-
getSize
public final Dimensions getSize()
Description copied from interface:Visual
Default method to return the visual's complete size via aDimensions
object. 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
width
andheight
values, but may need to do additional calculations before doing so.- Specified by:
setSize
in 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:ConstrainedVisual
Returns the visual's unconstrained preferred size.- Specified by:
getPreferredSize
in 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:Visual
Returns the visual's baseline.- Specified by:
getBaseline
in interfaceVisual
- Returns:
- The baseline relative to the origin of the visual, or
-1
if 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:
getBaseline
in 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
-1
if 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:Skin
Returns the component with which a skin is associated.- Specified by:
getComponent
in 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:
isFocusable
in interfaceSkin
- Returns:
true
if 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:ComponentListener
Called when a component's parent has changed (when the component is either added to or removed from a container).- Specified by:
parentChanged
in 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:ComponentListener
Called when a component's size has changed.- Specified by:
sizeChanged
in 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:ComponentListener
Called when a component's preferred size has changed.- Specified by:
preferredSizeChanged
in 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:ComponentListener
Called when a component's preferred width limits have changed.- Specified by:
widthLimitsChanged
in 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:ComponentListener
Called when a component's preferred height limits have changed.- Specified by:
heightLimitsChanged
in 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:ComponentListener
Called when a component's location has changed.- Specified by:
locationChanged
in 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:ComponentListener
Called when a component's visible flag has changed.- Specified by:
visibleChanged
in interfaceComponentListener
- Parameters:
component
- Component that has changed visibility.
-
cursorChanged
public void cursorChanged(Component component, Cursor previousCursor)
Description copied from interface:ComponentListener
Called when a component's cursor has changed.- Specified by:
cursorChanged
in 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:ComponentListener
Called when a component's tooltip text has changed.- Specified by:
tooltipTextChanged
in 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:ComponentListener
Called when a component's tooltip delay has changed.- Specified by:
tooltipDelayChanged
in 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:ComponentListener
Called when a component's drag source has changed.- Specified by:
dragSourceChanged
in interfaceComponentListener
- Parameters:
component
- The component in question.previousDragSource
- The previous value of theDragSource
for this component.
-
dropTargetChanged
public void dropTargetChanged(Component component, DropTarget previousDropTarget)
Description copied from interface:ComponentListener
Called when a component's drop target has changed.- Specified by:
dropTargetChanged
in interfaceComponentListener
- Parameters:
component
- The component that is changing.previousDropTarget
- The previous value of theDropTarget
for this component.
-
menuHandlerChanged
public void menuHandlerChanged(Component component, MenuHandler previousMenuHandler)
Description copied from interface:ComponentListener
Called when a component's context menu handler has changed.- Specified by:
menuHandlerChanged
in 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:ComponentListener
Called when a component's name has changed.- Specified by:
nameChanged
in interfaceComponentListener
- Parameters:
component
- Component whose name changed.previousName
- Previous name for this component.
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListener
Called when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabled
flag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()
method.- Specified by:
enabledChanged
in interfaceComponentStateListener
- Parameters:
component
- The component whose enabled state is changing.
-
focusedChanged
public void focusedChanged(Component component, Component obverseComponent)
Description copied from interface:ComponentStateListener
Called 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:
focusedChanged
in 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:ComponentMouseListener
Called when the mouse is moved over a component.- Specified by:
mouseMove
in interfaceComponentMouseListener
- Parameters:
component
- Component that is under the mouse.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default return).
-
mouseOver
public void mouseOver(Component component)
Description copied from interface:ComponentMouseListener
Called when the mouse enters a component.Default is to do nothing.
- Specified by:
mouseOver
in interfaceComponentMouseListener
- Parameters:
component
- Component that is now under the mouse pointer.
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListener
Called when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOut
in 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:ComponentMouseButtonListener
Called when a mouse button is pressed over a component.- Specified by:
mouseDown
in 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:
true
to consume the event;false
to allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is released over a component.- Specified by:
mouseUp
in 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:
true
to consume the event;false
to allow it to propagate (default).
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is clicked over a component.- Specified by:
mouseClick
in 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:
true
to consume the event;false
to 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:ComponentMouseWheelListener
Called when the mouse wheel is scrolled over a component.- Specified by:
mouseWheel
in 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:
true
to consume the event;false
to allow it to propagate.
-
keyTyped
public boolean keyTyped(Component component, char character)
Description copied from interface:ComponentKeyListener
Called when a key has been typed.- Specified by:
keyTyped
in interfaceComponentKeyListener
- Parameters:
component
- Component that has the focus, that is receiving this key.character
- The decoded character that was typed.- Returns:
true
to consume the event;false
to allow it to propagate.
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Keyboard handling (Tab key or Shift Tab).- Specified by:
keyPressed
in 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:
true
to consume the event;false
to allow it to propagate.
-
keyReleased
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Description copied from interface:ComponentKeyListener
Called when a key has been released.- Specified by:
keyReleased
in 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:
true
to consume the event;false
to allow it to propagate.
-
tooltipTriggered
public void tooltipTriggered(Component component, int x, int y)
Description copied from interface:ComponentTooltipListener
Called when a tooltip has been triggered over a component.- Specified by:
tooltipTriggered
in 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
-true
to 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
-true
to 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 isnull
or 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 isnull
or 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:
true
if it is dark,false
otherwise (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:
true
if it is flat,false
otherwise (default)
-
themeHasTransitionEnabled
public final boolean themeHasTransitionEnabled()
Returns whether the current Theme has transitions enabled.- Returns:
true
if transitions are enabled (default),false
otherwise
-
themeHasThickFocusRectangle
public final boolean themeHasThickFocusRectangle()
Returns whether the current Theme has thick focus rectangles.- Returns:
true
if thick focus rectangles are drawn (new default), orfalse
otherwise (default for previous versions).
-
defaultBackgroundColor
public final java.awt.Color defaultBackgroundColor()
Returns the Theme default background color.- Returns:
Color.WHITE
if the theme is not dark (default), orColor.BLACK
.
-
defaultForegroundColor
public final java.awt.Color defaultForegroundColor()
Returns the Theme default foreground color.- Returns:
Color.BLACK
if 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 ourCSSColor
values, or an integer index into the theme's color palette.- Returns:
- The real
Color
value. - Throws:
java.lang.IllegalArgumentException
- if thecolorValue
isnull
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, boolean allowNull)
Interpret an object as a color value.- Parameters:
colorValue
- One of aString
(interpreted byGraphicsUtilities.decodeColor(String,String)
), a straightColor
, one of ourCSSColor
values, or an integer index into the theme's color palette.allowNull
- Whether or not to allow a null color.- Returns:
- The real
Color
value. - Throws:
java.lang.IllegalArgumentException
- if thecolorValue
isnull
(unlessallowNull
istrue
), 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 ourCSSColor
values, 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
Color
value. - Throws:
java.lang.IllegalArgumentException
- if thecolorValue
isnull
, 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 ourCSSColor
values, 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
Color
value. - Throws:
java.lang.IllegalArgumentException
- if thecolorValue
isnull
(unlessallowNull
istrue
), 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.
-
-