Package org.pushingpixels.substance.api
Class SubstanceSkin
- java.lang.Object
-
- org.pushingpixels.substance.api.SubstanceSkin
-
- All Implemented Interfaces:
SubstanceTrait
- Direct Known Subclasses:
AutumnSkin,CeruleanSkin,GeminiSkin,GreenMagicSkin,MagellanSkin,MarinerSkin,ModerateSkin,NightShadeSkin,RavenSkin,SaharaSkin,SentinelSkin,SubstanceSkin.Accented,TwilightSkin
public abstract class SubstanceSkin extends java.lang.Object implements SubstanceTrait
Base abstract class for Substance skins.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubstanceSkin.AccentedBase class for skins that can be configured with accent color schemes.static interfaceSubstanceSkin.ColorSchemes
-
Field Summary
Fields Modifier and Type Field Description protected SubstanceBorderPainterborderPainterThe border painter ofthisskin.protected SubstanceButtonShaperbuttonShaperThe button shaper ofthisskin.protected SubstanceDecorationPainterdecorationPainterThe decoration painter ofthisskin.static doubleDEFAULT_TAB_FADE_ENDstatic doubleDEFAULT_TAB_FADE_STARTprotected SubstanceFillPainterfillPainterThe fill painter ofthisskin.protected SubstanceBorderPainterhighlightBorderPainterThe highlight border painter ofthisskin.protected SubstanceHighlightPainterhighlightPainterThe highlight painter ofthisskin.protected doubletabFadeEndThe end of fade effect on tabs inJTabbedPanes.protected doubletabFadeStartThe start of fade effect on tabs inJTabbedPanes.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSubstanceSkin()Constructs the basic data structures for a skin.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOverlayPainter(SubstanceOverlayPainter overlayPainter, SubstanceSlices.DecorationAreaType... areaTypes)Adds the specified overlay painter to the end of the list of overlay painters associated with the specified decoration area types.voidclearOverlayPainters(SubstanceSlices.DecorationAreaType... areaTypes)Removes all overlay painters associated with the specified decoration area types.SubstanceColorSchemegetActiveColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)Returns the main active color scheme for the specific decoration area type.floatgetAlpha(java.awt.Component comp, ComponentState componentState)Returns the alpha channel of the color scheme of the component.SubstanceColorSchemegetBackgroundColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)Returns the background color scheme for the specified decoration area type.SubstanceBorderPaintergetBorderPainter()Returns the border painter of this skin.SubstanceButtonShapergetButtonShaper()Returns the button shaper of this skin.SubstanceColorSchemegetColorScheme(java.awt.Component comp, ComponentState componentState)Returns the color scheme of the specified component in the specified component state.SubstanceColorSchemegetColorScheme(java.awt.Component comp, SubstanceSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.SubstanceColorSchemegetColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType, SubstanceSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)Returns the color scheme to be used for painting the specified visual area of components in the specified decoration area.static SubstanceSkin.ColorSchemesgetColorSchemes(java.io.InputStream inputStream)Returns the collection of color schemes in the specified input stream.SubstanceDecorationPaintergetDecorationPainter()Returns the decoration painter of this skin.SubstanceColorSchemegetDirectColorScheme(java.awt.Component comp, SubstanceSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.SubstanceColorSchemegetDisabledColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)Returns the main disabled color scheme for the specific decoration area type.SubstanceColorSchemegetEnabledColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)Returns the main enabled color scheme for the specific decoration area type.SubstanceFillPaintergetFillPainter()Returns the fill painter of this skin.floatgetHighlightAlpha(java.awt.Component comp, ComponentState componentState)Returns the alpha channel of the highlight color scheme of the component.SubstanceBorderPaintergetHighlightBorderPainter()Returns the highlight border painter of this skin.SubstanceHighlightPaintergetHighlightPainter()Returns the highlight painter of this skin.SubstanceColorSchemegetOptionPaneIconColorScheme(int optionPaneMessageType)java.awt.ColorgetOverlayColor(SubstanceSlices.ColorOverlayType colorOverlayType, SubstanceSlices.DecorationAreaType decorationAreaType, ComponentState componentState)java.util.List<SubstanceOverlayPainter>getOverlayPainters(SubstanceSlices.DecorationAreaType decorationAreaType)Returns a non-null, non-modifiable list of overlay painters associated with the specified decoration area type.doublegetTabFadeEnd()Returns the end of fade effect on tabs inJTabbedPanes.doublegetTabFadeStart()Returns the start of fade effect on tabs inJTabbedPanes.booleanisRegisteredAsDecorationArea(SubstanceSlices.DecorationAreaType decorationType)Returns indication whether the specified decoration area type should have their background painted bySubstanceDecorationPainter.paintDecorationArea(Graphics2D, Component, SubstanceSlices.DecorationAreaType, int, int, SubstanceSkin)instead of a simple background fill.booleanisValid()Checks whether this skin is valid.voidregisterAsDecorationArea(SubstanceColorScheme backgroundColorScheme, SubstanceColorSchemeBundle.Overlay noneTransformationOverlay, SubstanceSlices.DecorationAreaType... areaTypes)Registers the specified background color scheme and a color scheme bundle overlay to be used on controls in decoration areas.voidregisterAsDecorationArea(SubstanceColorScheme backgroundColorScheme, SubstanceSlices.DecorationAreaType... areaTypes)Registers the specified background color scheme to be used on controls in decoration areas.voidregisterDecorationAreaSchemeBundle(SubstanceColorSchemeBundle bundle, SubstanceColorScheme backgroundColorScheme, SubstanceSlices.DecorationAreaType... areaTypes)Registers the specified color scheme bundle and background color scheme to be used on controls in decoration areas.voidregisterDecorationAreaSchemeBundle(SubstanceColorSchemeBundle bundle, SubstanceSlices.DecorationAreaType... areaTypes)Registers the specified color scheme bundle to be used on controls in decoration areas.voidremoveOverlayPainter(SubstanceOverlayPainter overlayPainter, SubstanceSlices.DecorationAreaType... areaTypes)Removes the specified overlay painter from the list of overlay painters associated with the specified decoration area types.voidsetOptionPaneIconColorScheme(SubstanceColorScheme colorScheme, int... optionPaneMessageTypes)voidsetOverlayColor(java.awt.Color color, SubstanceSlices.ColorOverlayType colorOverlayType, SubstanceSlices.DecorationAreaType decorationAreaType, ComponentState... componentStates)voidsetTabFadeEnd(double tabFadeEnd)Sets the end of fade effect on tabs inJTabbedPanes.voidsetTabFadeStart(double tabFadeStart)Sets the start of fade effect on selected tabs inJTabbedPanes.SubstanceSkintransform(ColorSchemeTransform transform, java.lang.String name)Creates a new skin that has the same settings as this skin with the addition of applying the specified color scheme transformation on all the relevant color schemes.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pushingpixels.substance.api.trait.SubstanceTrait
getDisplayName
-
-
-
-
Field Detail
-
DEFAULT_TAB_FADE_START
public static final double DEFAULT_TAB_FADE_START
- See Also:
- Constant Field Values
-
DEFAULT_TAB_FADE_END
public static final double DEFAULT_TAB_FADE_END
- See Also:
- Constant Field Values
-
buttonShaper
protected SubstanceButtonShaper buttonShaper
The button shaper ofthisskin. Must be non-null.
-
fillPainter
protected SubstanceFillPainter fillPainter
The fill painter ofthisskin. Must be non-null.
-
borderPainter
protected SubstanceBorderPainter borderPainter
The border painter ofthisskin. Must be non-null.
-
highlightBorderPainter
protected SubstanceBorderPainter highlightBorderPainter
The highlight border painter ofthisskin. Can benull.
-
highlightPainter
protected SubstanceHighlightPainter highlightPainter
The highlight painter ofthisskin. Must be non-null.
-
decorationPainter
protected SubstanceDecorationPainter decorationPainter
The decoration painter ofthisskin. Must be non-null.
-
tabFadeStart
protected double tabFadeStart
The start of fade effect on tabs inJTabbedPanes.- See Also:
tabFadeEnd,DEFAULT_TAB_FADE_START
-
tabFadeEnd
protected double tabFadeEnd
The end of fade effect on tabs inJTabbedPanes.- See Also:
tabFadeStart,DEFAULT_TAB_FADE_END
-
-
Method Detail
-
getBorderPainter
public final SubstanceBorderPainter getBorderPainter()
Returns the border painter of this skin.
-
getHighlightBorderPainter
public final SubstanceBorderPainter getHighlightBorderPainter()
Returns the highlight border painter of this skin.- Returns:
- The highlight border painter of this skin. The return value of
this method may be
null. In this case, callgetBorderPainter().
-
getButtonShaper
public final SubstanceButtonShaper getButtonShaper()
Returns the button shaper of this skin.
-
getFillPainter
public final SubstanceFillPainter getFillPainter()
Returns the fill painter of this skin.
-
getHighlightPainter
public final SubstanceHighlightPainter getHighlightPainter()
Returns the highlight painter of this skin.
-
getDecorationPainter
public final SubstanceDecorationPainter getDecorationPainter()
Returns the decoration painter of this skin.
-
getColorScheme
public final SubstanceColorScheme getColorScheme(java.awt.Component comp, ComponentState componentState)
Returns the color scheme of the specified component in the specified component state.- Parameters:
comp- Component.componentState- Component state.- Returns:
- The color scheme of the component in the specified component state.
-
getHighlightAlpha
public final float getHighlightAlpha(java.awt.Component comp, ComponentState componentState)Returns the alpha channel of the highlight color scheme of the component.- Parameters:
comp- Component.componentState- Component state.- Returns:
- Highlight color scheme alpha channel.
-
getAlpha
public final float getAlpha(java.awt.Component comp, ComponentState componentState)Returns the alpha channel of the color scheme of the component.- Parameters:
comp- Component.componentState- Component state.- Returns:
- Color scheme alpha channel.
-
registerDecorationAreaSchemeBundle
public void registerDecorationAreaSchemeBundle(SubstanceColorSchemeBundle bundle, SubstanceColorScheme backgroundColorScheme, SubstanceSlices.DecorationAreaType... areaTypes)
Registers the specified color scheme bundle and background color scheme to be used on controls in decoration areas.- Parameters:
bundle- The color scheme bundle to use on controls in decoration areas.backgroundColorScheme- The color scheme to use for background of controls in decoration areas.areaTypes- Enumerates the area types that are affected by the parameters.
-
registerDecorationAreaSchemeBundle
public void registerDecorationAreaSchemeBundle(SubstanceColorSchemeBundle bundle, SubstanceSlices.DecorationAreaType... areaTypes)
Registers the specified color scheme bundle to be used on controls in decoration areas.- Parameters:
bundle- The color scheme bundle to use on controls in decoration areas.areaTypes- Enumerates the area types that are affected by the parameters.
-
registerAsDecorationArea
public void registerAsDecorationArea(SubstanceColorScheme backgroundColorScheme, SubstanceSlices.DecorationAreaType... areaTypes)
Registers the specified background color scheme to be used on controls in decoration areas.- Parameters:
backgroundColorScheme- The color scheme to use for background of controls in decoration areas.areaTypes- Enumerates the area types that are affected by the parameters. Each decoration area type will be painted bySubstanceDecorationPainter.paintDecorationArea(Graphics2D, Component, SubstanceSlices.DecorationAreaType, int, int, SubstanceSkin)
-
registerAsDecorationArea
public void registerAsDecorationArea(SubstanceColorScheme backgroundColorScheme, SubstanceColorSchemeBundle.Overlay noneTransformationOverlay, SubstanceSlices.DecorationAreaType... areaTypes)
Registers the specified background color scheme and a color scheme bundle overlay to be used on controls in decoration areas.- Parameters:
backgroundColorScheme- The color scheme to use for background of controls in decoration areas.noneTransformationOverlay- Overlay to be applied to theSubstanceColorSchemeBundleregistered on theSubstanceSlices.DecorationAreaType.NONE, with the resulting color scheme bundle to be used on #areaTypes.areaTypes- Enumerates the area types that are affected by the parameters. Each decoration area type will be painted bySubstanceDecorationPainter.paintDecorationArea(Graphics2D, Component, SubstanceSlices.DecorationAreaType, int, int, SubstanceSkin)
-
isRegisteredAsDecorationArea
public boolean isRegisteredAsDecorationArea(SubstanceSlices.DecorationAreaType decorationType)
Returns indication whether the specified decoration area type should have their background painted bySubstanceDecorationPainter.paintDecorationArea(Graphics2D, Component, SubstanceSlices.DecorationAreaType, int, int, SubstanceSkin)instead of a simple background fill.- Parameters:
decorationType- Decoration area type.- Returns:
trueif specified decoration area type should have their background painted bySubstanceDecorationPainter.paintDecorationArea(Graphics2D, Component, SubstanceSlices.DecorationAreaType, int, int, SubstanceSkin),falseotherwise.
-
getActiveColorScheme
public final SubstanceColorScheme getActiveColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)
Returns the main active color scheme for the specific decoration area type. Custom painting code that needs to consult the colors of the specific component should usegetColorScheme(Component, ComponentState)method and variousSubstanceColorSchememethods.- Parameters:
decorationAreaType- Decoration area type.- Returns:
- The main active color scheme for this skin.
- See Also:
getColorScheme(Component, ComponentState)
-
getEnabledColorScheme
public final SubstanceColorScheme getEnabledColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)
Returns the main enabled color scheme for the specific decoration area type. Custom painting code that needs to consult the colors of the specific component should usegetColorScheme(Component, ComponentState)method and variousSubstanceColorSchememethods.- Parameters:
decorationAreaType- Decoration area type.- Returns:
- The main enabled color scheme for this skin.
- See Also:
getColorScheme(Component, ComponentState)
-
getDisabledColorScheme
public final SubstanceColorScheme getDisabledColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)
Returns the main disabled color scheme for the specific decoration area type. Custom painting code that needs to consult the colors of the specific component should usegetColorScheme(Component, ComponentState)method and variousSubstanceColorSchememethods.- Parameters:
decorationAreaType- Decoration area type.- Returns:
- The main disabled color scheme for this skin.
- See Also:
getColorScheme(Component, ComponentState)
-
getTabFadeStart
public final double getTabFadeStart()
Returns the start of fade effect on tabs inJTabbedPanes. This value can be used to create XP-like "headers" on the selected tabs.- Returns:
- The start of fade effect on the selected tabs in
JTabbedPanes. - See Also:
getTabFadeEnd(),DEFAULT_TAB_FADE_START
-
getTabFadeEnd
public final double getTabFadeEnd()
Returns the end of fade effect on tabs inJTabbedPanes. This value can be used to create XP-like "headers" on the selected tabs.- Returns:
- The end of fade effect on the selected tabs in
JTabbedPanes. - See Also:
getTabFadeStart(),DEFAULT_TAB_FADE_END
-
setTabFadeEnd
public void setTabFadeEnd(double tabFadeEnd)
Sets the end of fade effect on tabs inJTabbedPanes. The value should be in 0.0-1.0 range.- Parameters:
tabFadeEnd- The end of fade effect on tabs inJTabbedPanes. Should be in 0.0-1.0 range.- See Also:
DEFAULT_TAB_FADE_END
-
setTabFadeStart
public void setTabFadeStart(double tabFadeStart)
Sets the start of fade effect on selected tabs inJTabbedPanes. The value should be in 0.0-1.0 range.- Parameters:
tabFadeStart- The start of fade effect on tabs inJTabbedPanes. Should be in 0.0-1.0 range.- See Also:
DEFAULT_TAB_FADE_START
-
addOverlayPainter
public void addOverlayPainter(SubstanceOverlayPainter overlayPainter, SubstanceSlices.DecorationAreaType... areaTypes)
Adds the specified overlay painter to the end of the list of overlay painters associated with the specified decoration area types.- Parameters:
overlayPainter- Overlay painter to add to the end of the list of overlay painters associated with the specified decoration area types.areaTypes- Decoration area types.
-
removeOverlayPainter
public void removeOverlayPainter(SubstanceOverlayPainter overlayPainter, SubstanceSlices.DecorationAreaType... areaTypes)
Removes the specified overlay painter from the list of overlay painters associated with the specified decoration area types.- Parameters:
overlayPainter- Overlay painter to remove from the list of overlay painters associated with the specified decoration area types.areaTypes- Decoration area types.
-
clearOverlayPainters
public void clearOverlayPainters(SubstanceSlices.DecorationAreaType... areaTypes)
Removes all overlay painters associated with the specified decoration area types.- Parameters:
areaTypes- Decoration area types.
-
getOverlayPainters
public java.util.List<SubstanceOverlayPainter> getOverlayPainters(SubstanceSlices.DecorationAreaType decorationAreaType)
Returns a non-null, non-modifiable list of overlay painters associated with the specified decoration area type.- Parameters:
decorationAreaType- Decoration area type.- Returns:
- A non-null, non-modifiable list of overlay painters associated with the specified decoration area type.
-
getColorScheme
public final SubstanceColorScheme getColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType, SubstanceSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of components in the specified decoration area.- Parameters:
decorationAreaType- Decoration area type.associationKind- Color scheme association kind.componentState- Component state.- Returns:
- Color scheme to be used for painting the specified visual area of components in the specified decoration area.
-
getColorScheme
public final SubstanceColorScheme getColorScheme(java.awt.Component comp, SubstanceSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.- Parameters:
comp- Component.associationKind- Color scheme association kind.componentState- Component state.- Returns:
- Color scheme to be used for painting the specified visual area of the component under the specified component state.
-
getDirectColorScheme
public final SubstanceColorScheme getDirectColorScheme(java.awt.Component comp, SubstanceSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.- Parameters:
comp- Component.associationKind- Color scheme association kind.componentState- Component state.- Returns:
- Color scheme to be used for painting the specified visual area of the component under the specified component state.
-
transform
public SubstanceSkin transform(ColorSchemeTransform transform, java.lang.String name)
Creates a new skin that has the same settings as this skin with the addition of applying the specified color scheme transformation on all the relevant color schemes.- Parameters:
transform- Color scheme transformation.name- The name of the new skin.- Returns:
- The new skin.
-
getBackgroundColorScheme
public final SubstanceColorScheme getBackgroundColorScheme(SubstanceSlices.DecorationAreaType decorationAreaType)
Returns the background color scheme for the specified decoration area type. This method is mainly for the internal use ofSubstanceDecorationPainter.paintDecorationArea(Graphics2D, Component, SubstanceSlices.DecorationAreaType, int, int, SubstanceSkin)but can be used in applications that wish to provide custom overlay background painting.- Parameters:
decorationAreaType- Decoration area type.- Returns:
- The background color scheme for the specified decoration area type.
-
setOverlayColor
public void setOverlayColor(java.awt.Color color, SubstanceSlices.ColorOverlayType colorOverlayType, SubstanceSlices.DecorationAreaType decorationAreaType, ComponentState... componentStates)
-
getOverlayColor
public java.awt.Color getOverlayColor(SubstanceSlices.ColorOverlayType colorOverlayType, SubstanceSlices.DecorationAreaType decorationAreaType, ComponentState componentState)
-
setOptionPaneIconColorScheme
public void setOptionPaneIconColorScheme(SubstanceColorScheme colorScheme, int... optionPaneMessageTypes)
-
getOptionPaneIconColorScheme
public SubstanceColorScheme getOptionPaneIconColorScheme(int optionPaneMessageType)
-
isValid
public boolean isValid()
Checks whether this skin is valid. A valid skin must have a color scheme bundle forSubstanceSlices.DecorationAreaType.NONEand non-nullbutton shaper, gradient painter, border painter, highlight painter and decoration painter. If call toSubstanceCortex.GlobalScope.setSkin(String)orSubstanceCortex.GlobalScope.setSkin(SubstanceSkin)does not seem to have any visible effect (returningfalse), call this method to verify that your skin is valid.- Returns:
trueif this skin is valid,falseotherwise.
-
getColorSchemes
public static SubstanceSkin.ColorSchemes getColorSchemes(java.io.InputStream inputStream)
Returns the collection of color schemes in the specified input stream.- Parameters:
inputStream- Input stream for the resource containing the description of Substance color schemes.- Returns:
- The collection of color schemes in the specified input stream.
-
-