org.jvnet.substance.theme
Class SubstanceComplexTheme

java.lang.Object
  extended by org.jvnet.substance.theme.SubstanceTheme
      extended by org.jvnet.substance.theme.SubstanceComplexTheme
All Implemented Interfaces:
SubstanceTrait

public class SubstanceComplexTheme
extends SubstanceTheme

Complex theme. A complex theme is defined by four separate themes:

This class is part of officially supported API.

Author:
Kirill Grouchnikov

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jvnet.substance.theme.SubstanceTheme
SubstanceTheme.ThemeKind
 
Field Summary
protected  SubstanceTheme activeTheme
          Theme for controls in active visual state.
protected  SubstanceTheme activeTitlePaneTheme
          Theme for title panes of active windows.
protected  SubstanceTheme defaultTheme
          Theme for controls in default visual state.
protected  SubstanceTheme defaultTitlePaneTheme
          Theme for title panes of inactive windows.
protected  SubstanceTheme disabledTheme
          Theme for controls in disabled visual state.
protected  SubstanceGradientPainter nonActivePainter
          Painter for painting the non-active controls.
protected  double selectedTabFadeEnd
          The end of fade effect on the selected tabs in JTabbedPanes.
protected  double selectedTabFadeStart
          The start of fade effect on the selected tabs in JTabbedPanes.
protected  java.util.Map<ComponentState,java.lang.Float> stateHighlightThemeAlphaMap
          Maps from component state to the alpha channel applied on highlight theme.
protected  java.util.Map<ComponentState,SubstanceTheme> stateHighlightThemeMap
          Maps from component state to the matching themes for highlight themes.
protected  java.util.Map<ComponentState,java.lang.Float> stateThemeAlphaMap
          Maps from component state to the alpha channel applied on theme.
protected  java.util.Map<ComponentState,SubstanceTheme> stateThemeMap
          Maps from component state to the matching themes.
protected  boolean useSameBackgroundColor
          If true, the light background color and the background color are the same.
protected  SubstanceTheme watermarkTheme
          Theme for watermarks.
 
Fields inherited from class org.jvnet.substance.theme.SubstanceTheme
AQUA, GREEN, ORANGE, YELLOW
 
Constructor Summary
SubstanceComplexTheme(java.lang.String displayName, SubstanceTheme.ThemeKind themeKind, SubstanceTheme activeTheme, SubstanceTheme defaultTheme, SubstanceTheme disabledTheme, SubstanceTheme activeTitlePaneTheme)
          Creates a new complex theme.
SubstanceComplexTheme(java.lang.String displayName, SubstanceTheme.ThemeKind themeKind, SubstanceTheme activeTheme, SubstanceTheme defaultTheme, SubstanceTheme disabledTheme, SubstanceTheme activeTitlePaneTheme, SubstanceTheme watermarkTheme)
          Creates a new complex theme.
 
Method Summary
protected  void copyTo(SubstanceComplexTheme dst)
          Copies theme-agnostic settings of this theme to the specified theme.
 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.
 SubstanceTheme getDefaultTheme()
          Returns the default theme that corresponds to this theme.
 SubstanceTheme getDefaultTitlePaneTheme()
          Returns the theme for title panes of inactive frames.
 SubstanceTheme getDisabledTheme()
          Returns the disabled theme that corresponds to this theme.
 SubstanceTheme getFirstTheme()
          Returns the first 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.
 java.awt.Color getLightBackgroundColor()
          Returns the light background 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.
 SubstanceTheme getTheme(java.awt.Component comp, ComponentState componentState)
          Returns the theme that corresponds to the specified component state.
 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.
 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.
 SubstanceTheme negate()
          Creates a negated version of this theme.
 SubstanceTheme protanopia()
          Creates a new version of this theme that simulates the protanopia color blindness.
 void registerComponentHighlightStateTheme(SubstanceTheme stateHighlightTheme, ComponentState... states)
          Registers a highlight theme for the specific component state if the component state is not null, or a global highlight theme otherwise.
 void registerComponentHighlightStateTheme(SubstanceTheme stateHighlightTheme, float alpha, ComponentState... states)
          Registers a highlight theme for the specific component state if the component state is not null, or a global highlight theme otherwise.
 void registerComponentStateTheme(SubstanceTheme stateTheme, boolean useForHighlights, ComponentState... states)
          Registers a theme for the specific component state.
 void registerComponentStateTheme(SubstanceTheme stateTheme, float alpha, boolean useForHighlights, ComponentState... states)
          Registers a theme for the specific component state.
 SubstanceTheme saturate(double saturateFactor, boolean toSaturateEverything)
          Creates a saturated or desaturated version of this theme.
 void setActiveTheme(SubstanceTheme activeTheme)
          Sets the theme for the active visual state.
 void setActiveTitlePaneTheme(SubstanceTheme activeTitlePaneTheme)
          Sets the theme for the title panes of active windows.
 void setDefaultTheme(SubstanceTheme defaultTheme)
          Sets the theme for the default visual state.
 void setDefaultTitlePaneTheme(SubstanceTheme defaultTitlePaneTheme)
          Sets the theme for title panes of inactive windows.
 void setDisabledTheme(SubstanceTheme disabledTheme)
          Sets the theme for the disabled visual state.
 void setNonActivePainter(SubstanceGradientPainter nonActivePainter)
          Sets the painter for painting the non-active controls.
 void setSelectedTabFadeEnd(double selectedTabFadeEnd)
          Sets the end of fade effect on the selected tabs in JTabbedPanes.
 void setSelectedTabFadeStart(double selectedTabFadeStart)
          Sets the start of fade effect on the selected tabs in JTabbedPanes.
 void setUseSameBackgroundColor(boolean useSameBackgroundColor)
          Sets usage of background color for light background color.
 void setWatermarkTheme(SubstanceTheme watermarkTheme)
          Sets the theme for the watermark.
 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.
 SubstanceTheme tritanopia()
          Creates a new version of this theme that simulates the tritanopia color blindness.
 
Methods inherited from class org.jvnet.substance.theme.SubstanceTheme
addCustomEntriesToTable, addUserDefined, createInstance, getBackgroundColor, getBorderTheme, getColorScheme, getDefaultColorScheme, getDefaultColorScheme, getDisabledBackgroundColor, getDisabledColorScheme, getDisabledColorScheme, getDisabledForegroundColor, getDisplayName, getForegroundColor, getKind, getLineColor, getLineColorDefault, getSelectionBackgroundColor, getSelectionCellForegroundColor, getSelectionForegroundColor, getTheme, getThemeName, getWatermarkStampColor, isDark, saturate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activeTheme

protected SubstanceTheme activeTheme
Theme for controls in active visual state.


defaultTheme

protected SubstanceTheme defaultTheme
Theme for controls in default visual state.


disabledTheme

protected SubstanceTheme disabledTheme
Theme for controls in disabled visual state.


activeTitlePaneTheme

protected SubstanceTheme activeTitlePaneTheme
Theme for title panes of active windows.


defaultTitlePaneTheme

protected SubstanceTheme defaultTitlePaneTheme
Theme for title panes of inactive windows.


watermarkTheme

protected SubstanceTheme watermarkTheme
Theme for watermarks.


stateThemeMap

protected java.util.Map<ComponentState,SubstanceTheme> stateThemeMap
Maps from component state to the matching themes. This map doesn't have to contain entries for all ComponentState instances.


stateThemeAlphaMap

protected java.util.Map<ComponentState,java.lang.Float> stateThemeAlphaMap
Maps from component state to the alpha channel applied on theme. This map doesn't have to contain entries for all ComponentState instances.


stateHighlightThemeMap

protected java.util.Map<ComponentState,SubstanceTheme> stateHighlightThemeMap
Maps from component state to the matching themes for highlight themes. This map doesn't have to contain entries for all ComponentState instances.


stateHighlightThemeAlphaMap

protected java.util.Map<ComponentState,java.lang.Float> stateHighlightThemeAlphaMap
Maps from component state to the alpha channel applied on highlight theme. This map doesn't have to contain entries for all ComponentState instances.


nonActivePainter

protected SubstanceGradientPainter nonActivePainter
Painter for painting the non-active controls.


selectedTabFadeStart

protected double selectedTabFadeStart
The start of fade effect on the selected tabs in JTabbedPanes.

See Also:
selectedTabFadeEnd

selectedTabFadeEnd

protected double selectedTabFadeEnd
The end of fade effect on the selected tabs in JTabbedPanes.

See Also:
selectedTabFadeStart

useSameBackgroundColor

protected boolean useSameBackgroundColor
If true, the light background color and the background color are the same.

Since:
version 4.0
Constructor Detail

SubstanceComplexTheme

public SubstanceComplexTheme(java.lang.String displayName,
                             SubstanceTheme.ThemeKind themeKind,
                             SubstanceTheme activeTheme,
                             SubstanceTheme defaultTheme,
                             SubstanceTheme disabledTheme,
                             SubstanceTheme activeTitlePaneTheme)
Creates a new complex theme.

Parameters:
displayName - Theme display name.
themeKind - Theme kind.
activeTheme - Active theme.
defaultTheme - Default theme.
disabledTheme - Disabled theme.
activeTitlePaneTheme - Active title pane theme.

SubstanceComplexTheme

public SubstanceComplexTheme(java.lang.String displayName,
                             SubstanceTheme.ThemeKind themeKind,
                             SubstanceTheme activeTheme,
                             SubstanceTheme defaultTheme,
                             SubstanceTheme disabledTheme,
                             SubstanceTheme activeTitlePaneTheme,
                             SubstanceTheme watermarkTheme)
Creates a new complex theme.

Parameters:
displayName - Theme display name.
themeKind - Theme kind.
activeTheme - Active theme.
defaultTheme - Default theme.
disabledTheme - Disabled theme.
activeTitlePaneTheme - Active title pane theme.
watermarkTheme - Watermark theme.
Method Detail

getActiveTheme

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

Overrides:
getActiveTheme in class SubstanceTheme
Returns:
The active theme that corresponds to this theme.

getDefaultTheme

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

Overrides:
getDefaultTheme in class SubstanceTheme
Returns:
The default theme that corresponds to this theme.

getDisabledTheme

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

Overrides:
getDisabledTheme in class SubstanceTheme
Returns:
The disabled theme that corresponds to this theme.

getActiveTitlePaneTheme

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

Overrides:
getActiveTitlePaneTheme in class SubstanceTheme
Returns:
Theme for title panes of active frames

getDefaultTitlePaneTheme

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

Overrides:
getDefaultTitlePaneTheme in class SubstanceTheme
Returns:
Theme for title panes of inactive frames

getLightBackgroundColor

public java.awt.Color getLightBackgroundColor()
Description copied from class: SubstanceTheme
Returns the light background color for this theme.

Overrides:
getLightBackgroundColor in class SubstanceTheme
Returns:
The light background color for this theme.

getFirstTheme

public SubstanceTheme getFirstTheme()
Description copied from class: SubstanceTheme
Returns the first theme. This method is for internal use only.

Overrides:
getFirstTheme in class SubstanceTheme
Returns:
First theme.

getSecondTheme

public SubstanceTheme getSecondTheme()
Description copied from class: SubstanceTheme
Returns the second theme. This method is for internal use only.

Overrides:
getSecondTheme in class SubstanceTheme
Returns:
Second theme.

saturate

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

Overrides:
saturate in class SubstanceTheme
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 SubstanceTheme.getActiveTheme() will be saturated.
Returns:
Saturated version of this theme.

shade

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

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

tint

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

Overrides:
tint in class SubstanceTheme
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)
Description copied from class: SubstanceTheme
Creates a toned (shifted towards gray) version of this theme. This method is part of officially supported API.

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

invert

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

Overrides:
invert in class SubstanceTheme
Returns:
Inverted version of this theme.

negate

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

Overrides:
negate in class SubstanceTheme
Returns:
Negated version of this theme.

hueShift

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

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

protanopia

public SubstanceTheme protanopia()
Description copied from class: SubstanceTheme
Creates a new version of this theme that simulates the protanopia color blindness.

Overrides:
protanopia in class SubstanceTheme
Returns:
New version of this theme that simulates the protanopia color blindness.

tritanopia

public SubstanceTheme tritanopia()
Description copied from class: SubstanceTheme
Creates a new version of this theme that simulates the tritanopia color blindness.

Overrides:
tritanopia in class SubstanceTheme
Returns:
New version of this theme that simulates the tritanopia color blindness.

deuteranopia

public SubstanceTheme deuteranopia()
Description copied from class: SubstanceTheme
Creates a new version of this theme that simulates the deuteranopia color blindness.

Overrides:
deuteranopia in class SubstanceTheme
Returns:
New version of this theme that simulates the deuteranopia color blindness.

getWatermarkTheme

public SubstanceTheme getWatermarkTheme()
Description copied from class: SubstanceTheme
Returns the theme for watermark painting.

Overrides:
getWatermarkTheme in class SubstanceTheme
Returns:
Theme for watermark painting.

getNonActivePainter

public SubstanceGradientPainter getNonActivePainter()
Description copied from class: SubstanceTheme
Returns the painter for painting the non-active controls.

Overrides:
getNonActivePainter in class SubstanceTheme
Returns:
Painter for painting the non-active controls.

setNonActivePainter

public void setNonActivePainter(SubstanceGradientPainter nonActivePainter)
Sets the painter for painting the non-active controls.

Parameters:
nonActivePainter - Painter for painting the non-active controls.

setDefaultTitlePaneTheme

public void setDefaultTitlePaneTheme(SubstanceTheme defaultTitlePaneTheme)
Sets the theme for title panes of inactive windows.

Parameters:
defaultTitlePaneTheme - Theme for title panes of inactive windows.
Since:
version 3.3

setDefaultTheme

public void setDefaultTheme(SubstanceTheme defaultTheme)
Sets the theme for the default visual state.

Parameters:
defaultTheme - The theme for the default visual state.
Since:
version 4.0

setDisabledTheme

public void setDisabledTheme(SubstanceTheme disabledTheme)
Sets the theme for the disabled visual state.

Parameters:
disabledTheme - The theme for the disabled visual state.
Since:
version 4.0

setActiveTheme

public void setActiveTheme(SubstanceTheme activeTheme)
Sets the theme for the active visual state.

Parameters:
activeTheme - The theme for the active visual state.
Since:
version 4.0

setActiveTitlePaneTheme

public void setActiveTitlePaneTheme(SubstanceTheme activeTitlePaneTheme)
Sets the theme for the title panes of active windows.

Parameters:
activeTitlePaneTheme - The theme for the title panes of active windows.
Since:
version 4.0

setWatermarkTheme

public void setWatermarkTheme(SubstanceTheme watermarkTheme)
Sets the theme for the watermark.

Parameters:
watermarkTheme - The theme for the watermark.
Since:
version 4.0

getSelectedTabFadeStart

public double getSelectedTabFadeStart()
Description copied from class: SubstanceTheme
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.

Overrides:
getSelectedTabFadeStart in class SubstanceTheme
Returns:
The start of fade effect on the selected tabs in JTabbedPanes.
See Also:
SubstanceTheme.getSelectedTabFadeEnd()

getSelectedTabFadeEnd

public double getSelectedTabFadeEnd()
Description copied from class: SubstanceTheme
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.

Overrides:
getSelectedTabFadeEnd in class SubstanceTheme
Returns:
The end of fade effect on the selected tabs in JTabbedPanes.
See Also:
SubstanceTheme.getSelectedTabFadeStart()

setSelectedTabFadeEnd

public void setSelectedTabFadeEnd(double selectedTabFadeEnd)
Sets the end of fade effect on the selected tabs in JTabbedPanes. The value should be in 0.0-1.0 range.

Parameters:
selectedTabFadeEnd - The end of fade effect on the selected tabs in JTabbedPanes. Should be in 0.0-1.0 range.

setSelectedTabFadeStart

public void setSelectedTabFadeStart(double selectedTabFadeStart)
Sets the start of fade effect on the selected tabs in JTabbedPanes. The value should be in 0.0-1.0 range.

Parameters:
selectedTabFadeStart - The start of fade effect on the selected tabs in JTabbedPanes. Should be in 0.0-1.0 range.

setUseSameBackgroundColor

public void setUseSameBackgroundColor(boolean useSameBackgroundColor)
Sets usage of background color for light background color.

Parameters:
useSameBackgroundColor - if true, the light background color and the background color are the same.

registerComponentStateTheme

public void registerComponentStateTheme(SubstanceTheme stateTheme,
                                        float alpha,
                                        boolean useForHighlights,
                                        ComponentState... states)
Registers a theme for the specific component state.

Parameters:
stateTheme - Theme for the specified component state.
alpha - Alpha channel for the theme.
useForHighlights - if true, the specified theme will be used as highlight theme as well (for the same component state).
states - Component states.

registerComponentStateTheme

public void registerComponentStateTheme(SubstanceTheme stateTheme,
                                        boolean useForHighlights,
                                        ComponentState... states)
Registers a theme for the specific component state.

Parameters:
stateTheme - Theme for the specified component state.
useForHighlights - if true, the specified theme will be used as highlight theme as well (for the same component state).
states - Component states.

registerComponentHighlightStateTheme

public void registerComponentHighlightStateTheme(SubstanceTheme stateHighlightTheme,
                                                 ComponentState... states)
Registers a highlight theme for the specific component state if the component state is not null, or a global highlight theme otherwise.

Parameters:
stateHighlightTheme - Highlight theme for the specified component state.
states - Component states. If null, the specified theme will be applied for all states left unspecified.

registerComponentHighlightStateTheme

public void registerComponentHighlightStateTheme(SubstanceTheme stateHighlightTheme,
                                                 float alpha,
                                                 ComponentState... states)
Registers a highlight theme for the specific component state if the component state is not null, or a global highlight theme otherwise.

Parameters:
stateHighlightTheme - Highlight theme for the specified component state.
alpha - Alpha channel for the highlight theme.
states - Component states. If null, the specified theme will be applied for all states left unspecified.

getTheme

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

Overrides:
getTheme in class SubstanceTheme
Parameters:
comp - Component.
componentState - Component state.
Returns:
The theme that corresponds to the specified component state.

getHighlightTheme

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

Overrides:
getHighlightTheme in class SubstanceTheme
Parameters:
comp - Component.
componentState - Component state.
Returns:
The highlight theme that corresponds to the specified component state.

getHighlightThemeAlpha

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

Overrides:
getHighlightThemeAlpha in class SubstanceTheme
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)
Description copied from class: SubstanceTheme
Returns the alpha channel that is applied on theme when a component is in the specified state.

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

copyTo

protected void copyTo(SubstanceComplexTheme dst)
Copies theme-agnostic settings of this theme to the specified theme.

Parameters:
dst - Theme to copy to.