org.jvnet.substance.theme
Class SubstanceTheme

java.lang.Object
  extended by org.jvnet.substance.theme.SubstanceTheme
All Implemented Interfaces:
SubstanceTrait
Direct Known Subclasses:
SubstanceAquaTheme, SubstanceBarbyPinkTheme, SubstanceBlendBiTheme, SubstanceBottleGreenTheme, SubstanceBrownTheme, SubstanceCharcoalTheme, SubstanceComplexTheme, SubstanceCremeTheme, SubstanceDarkVioletTheme, SubstanceDesertSandTheme, SubstanceEbonyTheme, SubstanceJadeForestTheme, SubstanceLightAquaTheme, SubstanceLimeGreenTheme, SubstanceMixTheme, SubstanceOliveTheme, SubstanceOrangeTheme, SubstancePurpleTheme, SubstanceRaspberryTheme, SubstanceSepiaTheme, SubstanceSteelBlueTheme, SubstanceSunGlareTheme, SubstanceSunsetTheme, SubstanceTerracottaTheme, SubstanceUltramarineTheme, SubstanceWrapperTheme

public class SubstanceTheme
extends java.lang.Object
implements SubstanceTrait

Theme for Substance look and feel. This class is part of officially supported API.

Author:
Kirill Grouchnikov

Nested Class Summary
static class SubstanceTheme.ThemeKind
          Theme kind enumeration.
 
Field Summary
static ColorScheme AQUA
          Used as reference to the default color scheme.
static ColorScheme GREEN
          Used as reference to the green color scheme.
static ColorScheme ORANGE
          Used as reference in attention-drawing animations.
static ColorScheme YELLOW
          Used as reference in attention-drawing animations.
 
Constructor Summary
SubstanceTheme(ColorScheme colorScheme, java.lang.String displayName, SubstanceTheme.ThemeKind themeKind)
          Simple constructor.
 
Method Summary
 void addCustomEntriesToTable(javax.swing.UIDefaults table)
          Adds theme-specific entries to the UI defaults table.
static SubstanceTheme addUserDefined(ColorScheme scheme, SubstanceTheme.ThemeKind themeKind, java.lang.String displayName)
          Deprecated. since 3.1 Use SubstanceTheme(ColorScheme, String, org.jvnet.substance.theme.SubstanceTheme.ThemeKind) constructor instead.
static SubstanceTheme createInstance(ThemeInfo themeInfo)
          Creates a theme instance based on the specified theme info object.
 SubstanceTheme deuteranopia()
          Creates a new version of this theme that simulates the deuteranopia color blindness.
 SubstanceTheme getActiveTheme()
          Returns the active theme that corresponds to this theme.
 SubstanceTheme getActiveTitlePaneTheme()
          Returns the theme for title panes of active frames.
 java.awt.Color getBackgroundColor()
          Returns the background color for this theme.
 SubstanceTheme getBorderTheme()
          Returns the theme for border painting.
 ColorScheme getColorScheme()
          Returns the color scheme of this theme.
 ColorScheme getDefaultColorScheme()
          Returns the default color scheme that corresponds to this theme.
static ColorScheme getDefaultColorScheme(SubstanceTheme.ThemeKind themeKind)
          Returns the default scheme that corresponds to the specified theme kind.
 SubstanceTheme getDefaultTheme()
          Returns the default theme that corresponds to this theme.
 SubstanceTheme getDefaultTitlePaneTheme()
          Returns the theme for title panes of inactive frames.
 java.awt.Color getDisabledBackgroundColor()
          Returns the disabled background color for this theme.
 ColorScheme getDisabledColorScheme()
          Returns the disabled color scheme that corresponds to this theme.
static ColorScheme getDisabledColorScheme(SubstanceTheme.ThemeKind themeKind)
          Returns the disabled scheme that corresponds to the specified theme kind.
 java.awt.Color getDisabledForegroundColor()
          Returns the disabled foreground color for this theme.
 SubstanceTheme getDisabledTheme()
          Returns the disabled theme that corresponds to this theme.
 java.lang.String getDisplayName()
          Returns the display name of this trait.
 SubstanceTheme getFirstTheme()
          Returns the first theme.
 javax.swing.plaf.ColorUIResource getForegroundColor()
          Returns the foreground color for this theme.
 SubstanceTheme getHighlightTheme(java.awt.Component comp, ComponentState componentState)
          Returns the highlight theme that corresponds to the specified component state.
 float getHighlightThemeAlpha(java.awt.Component comp, ComponentState componentState)
          Returns the alpha channel that is applied on highlight theme when a component is in the specified state.
 SubstanceTheme.ThemeKind getKind()
          Returns the kind of this theme.
 java.awt.Color getLightBackgroundColor()
          Returns the light background color for this theme.
 java.awt.Color getLineColor()
          Returns the line color for this theme.
 java.awt.Color getLineColorDefault()
          Returns the line color for this theme.
 SubstanceGradientPainter getNonActivePainter()
          Returns the painter for painting the non-active controls.
 SubstanceTheme getSecondTheme()
          Returns the second theme.
 double getSelectedTabFadeEnd()
          Returns the end of fade effect on the selected tabs in JTabbedPanes.
 double getSelectedTabFadeStart()
          Returns the start of fade effect on the selected tabs in JTabbedPanes.
 java.awt.Color getSelectionBackgroundColor()
          Returns the selection background color for this theme.
 java.awt.Color getSelectionCellForegroundColor()
          Returns the foreground color for selected cells for this theme.
 java.awt.Color getSelectionForegroundColor()
          Returns the selection foreground color for this theme.
 SubstanceTheme getTheme(java.awt.Component comp, ComponentState componentState)
          Returns the theme that corresponds to the specified component state.
static SubstanceTheme getTheme(java.lang.String displayName)
          Returns the theme that matches the specified display name.
 float getThemeAlpha(java.awt.Component comp, ComponentState componentState)
          Returns the alpha channel that is applied on theme when a component is in the specified state.
 java.lang.String getThemeName()
          Returns the name of this theme.
 java.awt.Color getWatermarkStampColor()
          Returns the translucent watermark stamp color of this theme.
 SubstanceTheme getWatermarkTheme()
          Returns the theme for watermark painting.
 SubstanceTheme hueShift(double hueShiftFactor)
          Creates a hue-shifted (in HSB space) version of this theme.
 SubstanceTheme invert()
          Creates an inverted version of this theme.
 boolean isDark()
          Deprecated. Use getKind() instead.
 SubstanceTheme negate()
          Creates a negated version of this theme.
 SubstanceTheme protanopia()
          Creates a new version of this theme that simulates the protanopia color blindness.
 SubstanceTheme saturate(double saturateFactor)
          Creates a saturated or desaturated version of this theme.
 SubstanceTheme saturate(double saturateFactor, boolean toSaturateEverything)
          Creates a saturated or desaturated version of this theme.
 SubstanceTheme shade(double shadeFactor)
          Creates a shaded (shifted towards black) version of this theme.
 SubstanceTheme tint(double tintFactor)
          Creates a tinted (shifted towards white) version of this theme.
 SubstanceTheme tone(double toneFactor)
          Creates a toned (shifted towards gray) version of this theme.
 java.lang.String toString()
           
 SubstanceTheme tritanopia()
          Creates a new version of this theme that simulates the tritanopia color blindness.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AQUA

public static ColorScheme AQUA
Used as reference to the default color scheme. This field is for internal use only.


GREEN

public static ColorScheme GREEN
Used as reference to the green color scheme. This field is for internal use only.


YELLOW

public static ColorScheme YELLOW
Used as reference in attention-drawing animations. This field is for internal use only.


ORANGE

public static ColorScheme ORANGE
Used as reference in attention-drawing animations. This field is for internal use only.

Constructor Detail

SubstanceTheme

public SubstanceTheme(ColorScheme colorScheme,
                      java.lang.String displayName,
                      SubstanceTheme.ThemeKind themeKind)
Simple constructor. This constructor is part of officially supported API.

Parameters:
colorScheme - Color scheme for this theme.
displayName - Display name for this theme.
themeKind - Kind of this theme.
Method Detail

getColorScheme

public ColorScheme getColorScheme()
Returns the color scheme of this theme. This method is part of officially supported API.

Returns:
Color scheme of this theme.

getThemeName

public java.lang.String getThemeName()
Returns the name of this theme. This method is part of officially supported API.

Returns:
The name of this theme.

addCustomEntriesToTable

public void addCustomEntriesToTable(javax.swing.UIDefaults table)
Adds theme-specific entries to the UI defaults table.

Parameters:
table - UI defaults table.

getForegroundColor

public javax.swing.plaf.ColorUIResource getForegroundColor()
Returns the foreground color for this theme.

Returns:
The foreground color for this theme.
Since:
version 4.0

getSelectionCellForegroundColor

public java.awt.Color getSelectionCellForegroundColor()
Returns the foreground color for selected cells for this theme.

Returns:
The foreground color for selected cells for this theme.
Since:
version 4.0

getSelectionForegroundColor

public java.awt.Color getSelectionForegroundColor()
Returns the selection foreground color for this theme.

Returns:
The selection foreground color for this theme.
Since:
version 4.0

getSelectionBackgroundColor

public java.awt.Color getSelectionBackgroundColor()
Returns the selection background color for this theme.

Returns:
The selection background color for this theme.
Since:
version 4.0

getLineColor

public java.awt.Color getLineColor()
Returns the line color for this theme.

Returns:
The line color for this theme.
Since:
version 4.0

getLineColorDefault

public java.awt.Color getLineColorDefault()
Returns the line color for this theme.

Returns:
The line color for this theme.
Since:
version 4.0

getDisabledBackgroundColor

public java.awt.Color getDisabledBackgroundColor()
Returns the disabled background color for this theme.

Returns:
The disabled background color for this theme.
Since:
version 4.0

getDisabledForegroundColor

public java.awt.Color getDisabledForegroundColor()
Returns the disabled foreground color for this theme.

Returns:
The disabled foreground color for this theme.
Since:
version 4.0

getLightBackgroundColor

public java.awt.Color getLightBackgroundColor()
Returns the light background color for this theme.

Returns:
The light background color for this theme.
Since:
version 4.0

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the background color for this theme.

Returns:
The background color for this theme.
Since:
version 4.0

getKind

public SubstanceTheme.ThemeKind getKind()
Returns the kind of this theme. This method is part of officially supported API.

Returns:
The kind of this theme.

getDefaultColorScheme

public static ColorScheme getDefaultColorScheme(SubstanceTheme.ThemeKind themeKind)
Returns the default scheme that corresponds to the specified theme kind. This method is for internal use only.

Parameters:
themeKind - Theme kind.
Returns:
Default scheme that corresponds to the specified theme kind.

getDisabledColorScheme

public static ColorScheme getDisabledColorScheme(SubstanceTheme.ThemeKind themeKind)
Returns the disabled scheme that corresponds to the specified theme kind. This method is for internal use only.

Parameters:
themeKind - Theme kind.
Returns:
Disabled scheme that corresponds to the specified theme kind.

getDisplayName

public java.lang.String getDisplayName()
Description copied from interface: SubstanceTrait
Returns the display name of this trait. This method is part of officially supported API.

Specified by:
getDisplayName in interface SubstanceTrait
Returns:
The display name of this trait.

getTheme

public static SubstanceTheme getTheme(java.lang.String displayName)
Returns the theme that matches the specified display name. This method is for internal use only.

Parameters:
displayName - Theme display name.
Returns:
Theme that matches the specified display name.

getDefaultColorScheme

public ColorScheme getDefaultColorScheme()
Returns the default color scheme that corresponds to this theme. This method is for internal use only.

Returns:
The default color scheme that corresponds to this theme.

getDisabledColorScheme

public ColorScheme getDisabledColorScheme()
Returns the disabled color scheme that corresponds to this theme. This method is for internal use only.

Returns:
The disabled color scheme that corresponds to this theme.

getTheme

public SubstanceTheme getTheme(java.awt.Component comp,
                               ComponentState componentState)
Returns the theme that corresponds to the specified component state.

Parameters:
comp - Component.
componentState - Component state.
Returns:
The theme that corresponds to the specified component state.
Since:
version 4.0

getHighlightTheme

public SubstanceTheme getHighlightTheme(java.awt.Component comp,
                                        ComponentState componentState)
Returns the highlight theme that corresponds to the specified component state.

Parameters:
comp - Component.
componentState - Component state.
Returns:
The highlight theme that corresponds to the specified component state.
Since:
version 4.0

getHighlightThemeAlpha

public float getHighlightThemeAlpha(java.awt.Component comp,
                                    ComponentState componentState)
Returns the alpha channel that is applied on highlight theme when a component is in the specified state.

Parameters:
comp - Component.
componentState - Component state.
Returns:
Alpha channel that is applied on highlight theme when a component is in the specified state.

getThemeAlpha

public float getThemeAlpha(java.awt.Component comp,
                           ComponentState componentState)
Returns the alpha channel that is applied on theme when a component is in the specified state.

Parameters:
comp - Component.
componentState - Component state.
Returns:
Alpha channel that is applied on theme when a component is in the specified state.

getActiveTheme

public SubstanceTheme getActiveTheme()
Returns the active theme that corresponds to this theme. This method is for internal use only.

Returns:
The active theme that corresponds to this theme.

getDefaultTheme

public SubstanceTheme getDefaultTheme()
Returns the default theme that corresponds to this theme. This method is for internal use only.

Returns:
The default theme that corresponds to this theme.

getDisabledTheme

public SubstanceTheme getDisabledTheme()
Returns the disabled theme that corresponds to this theme. This method is for internal use only.

Returns:
The disabled theme that corresponds to this theme.

isDark

@Deprecated
public boolean isDark()
Deprecated. Use getKind() instead.

Returns indication whether this theme is dark. This method is part of officially supported API.

Returns:
true if this theme is dark, false otherwise.

addUserDefined

@Deprecated
public static SubstanceTheme addUserDefined(ColorScheme scheme,
                                                       SubstanceTheme.ThemeKind themeKind,
                                                       java.lang.String displayName)
Deprecated. since 3.1 Use SubstanceTheme(ColorScheme, String, org.jvnet.substance.theme.SubstanceTheme.ThemeKind) constructor instead.

Creates a new theme based on the specified parameters. Note that the preferred way is to create a plugin. This method is part of officially supported API.

Parameters:
scheme - Color scheme object.
themeKind - Theme kind.
displayName - Display name for the new theme.
Returns:
New theme object.

getWatermarkStampColor

public java.awt.Color getWatermarkStampColor()
Returns the translucent watermark stamp color of this theme. This method is for internal use only.

Returns:
Translucent watermark stamp color of this theme.

createInstance

public static SubstanceTheme createInstance(ThemeInfo themeInfo)
Creates a theme instance based on the specified theme info object. This method is for internal use only.

Parameters:
themeInfo - Theme info.
Returns:
Theme instance that matches the specified theme info object.

tint

public SubstanceTheme tint(double tintFactor)
Creates a tinted (shifted towards white) version of this theme. This method is part of officially supported API.

Parameters:
tintFactor - Value in 0.0...1.0 range. Larger values shift more towards white color.
Returns:
Tinted version of this theme.

tone

public SubstanceTheme tone(double toneFactor)
Creates a toned (shifted towards gray) version of this theme. This method is part of officially supported API.

Parameters:
toneFactor - Value in 0.0...1.0 range. Larger values shift more towards gray color.
Returns:
Toned version of this theme.

shade

public SubstanceTheme shade(double shadeFactor)
Creates a shaded (shifted towards black) version of this theme. This method is part of officially supported API.

Parameters:
shadeFactor - Value in 0.0...1.0 range. Larger values shift more towards black color.
Returns:
Shaded version of this theme.

saturate

public SubstanceTheme saturate(double saturateFactor)
Creates a saturated or desaturated version of this theme. The value and brightness stay the same. This method is part of officially supported API.

Parameters:
saturateFactor - Value in -1.0...1.0 range. Positive values create more saturated colors. Negative values create more desaturated colors.
Returns:
Saturated version of this theme.

saturate

public SubstanceTheme saturate(double saturateFactor,
                               boolean toSaturateEverything)
Creates a saturated or desaturated version of this theme. The value and brightness stay the same. This method is part of officially supported API.

Parameters:
saturateFactor - Value in -1.0...1.0 range. Positive values create more saturated colors. Negative values create more desaturated colors.
toSaturateEverything - If true, all visual components of this theme will be saturated. If false, only the getActiveTheme() will be saturated.
Returns:
Saturated version of this theme.

invert

public SubstanceTheme invert()
Creates an inverted version of this theme. This method is part of officially supported API.

Returns:
Inverted version of this theme.

negate

public SubstanceTheme negate()
Creates a negated version of this theme. This method is part of officially supported API.

Returns:
Negated version of this theme.

hueShift

public SubstanceTheme hueShift(double hueShiftFactor)
Creates a hue-shifted (in HSB space) version of this theme. This method is part of officially supported API.

Parameters:
hueShiftFactor - Value in -1.0...1.0 range.
Returns:
Hue-shifted version of this theme.

protanopia

public SubstanceTheme protanopia()
Creates a new version of this theme that simulates the protanopia color blindness.

Returns:
New version of this theme that simulates the protanopia color blindness.

tritanopia

public SubstanceTheme tritanopia()
Creates a new version of this theme that simulates the tritanopia color blindness.

Returns:
New version of this theme that simulates the tritanopia color blindness.

deuteranopia

public SubstanceTheme deuteranopia()
Creates a new version of this theme that simulates the deuteranopia color blindness.

Returns:
New version of this theme that simulates the deuteranopia color blindness.

getActiveTitlePaneTheme

public SubstanceTheme getActiveTitlePaneTheme()
Returns the theme for title panes of active frames. This method is for internal use only.

Returns:
Theme for title panes of active frames

getDefaultTitlePaneTheme

public SubstanceTheme getDefaultTitlePaneTheme()
Returns the theme for title panes of inactive frames. This method is for internal use only.

Returns:
Theme for title panes of inactive frames

getFirstTheme

public SubstanceTheme getFirstTheme()
Returns the first theme. This method is for internal use only.

Returns:
First theme.

getSecondTheme

public SubstanceTheme getSecondTheme()
Returns the second theme. This method is for internal use only.

Returns:
Second theme.

getWatermarkTheme

public SubstanceTheme getWatermarkTheme()
Returns the theme for watermark painting.

Returns:
Theme for watermark painting.

getBorderTheme

public SubstanceTheme getBorderTheme()
Returns the theme for border painting.

Returns:
Theme for border painting.
Since:
version 4.0

getNonActivePainter

public SubstanceGradientPainter getNonActivePainter()
Returns the painter for painting the non-active controls.

Returns:
Painter for painting the non-active controls.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getSelectedTabFadeStart

public double getSelectedTabFadeStart()
Returns the start of fade effect on the selected tabs in JTabbedPanes. 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:
getSelectedTabFadeEnd()

getSelectedTabFadeEnd

public double getSelectedTabFadeEnd()
Returns the end of fade effect on the selected tabs in JTabbedPanes. 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:
getSelectedTabFadeStart()