jgnash.ui
Class ThemeManager

java.lang.Object
  extended by jgnash.ui.ThemeManager

public class ThemeManager
extends java.lang.Object

Manages the look and feel and metal theme

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
private static long animationDuration
           
private static java.lang.String DEFAULT_THEME
           
private static java.lang.String[] KNOWN
           
private static java.lang.String LF
           
private static java.lang.String OCEAN
           
private  Resource rb
           
private static java.lang.String STEEL
           
private static java.lang.String SUBSTANCE_ANIMATIONS
           
private static java.lang.String THEME
           
private  java.util.ArrayList<java.lang.Object> themeList
           
private  javax.swing.JMenu themesMenu
           
 
Constructor Summary
protected ThemeManager(javax.swing.JFrame frame)
           
 
Method Summary
private  void addTheme(java.lang.String theme)
           
protected  javax.swing.JMenu buildLookAndFeelMenu()
          Loads the menu with the available look and feels for the application
protected  javax.swing.JMenu buildSubstanceMenu()
           
private  void buildThemeList()
           
protected  javax.swing.JMenu buildThemeMenu()
           
private static boolean isLookAndFeelAvailable(java.lang.String laf)
          A utility function that layers on top of the LookAndFeel's isSupportedLookAndFeel() method.
static boolean isLookAndFeelJGoodies()
           
static boolean isLookAndFeelMotif()
           
static boolean isLookAndFeelNimbus()
           
static boolean isLookAndFeelOSX()
          Determine is the current look and feel is the OSX Aqua look and feel
static boolean isLookAndFeelSubstance()
           
static boolean isSubstanceAnimationsEnabled()
           
static void reduceNimbusButtonMargin(javax.swing.JButton button)
          Reduce the margins around the content of a button for the Nimbus look and feel
private  void refreshThemesState()
           
private  void restartUI()
           
private static void setLookAndFeel(java.lang.String lookAndFeel)
           
static void setSubstanceAnimationsEnabled(boolean enabled)
           
private static void setTheme(java.lang.String theme)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

animationDuration

private static long animationDuration

rb

private final Resource rb

themesMenu

private javax.swing.JMenu themesMenu

themeList

private java.util.ArrayList<java.lang.Object> themeList

SUBSTANCE_ANIMATIONS

private static final java.lang.String SUBSTANCE_ANIMATIONS
See Also:
Constant Field Values

STEEL

private static final java.lang.String STEEL
See Also:
Constant Field Values

OCEAN

private static final java.lang.String OCEAN
See Also:
Constant Field Values

DEFAULT_THEME

private static java.lang.String DEFAULT_THEME

LF

private static final java.lang.String LF
See Also:
Constant Field Values

THEME

private static final java.lang.String THEME
See Also:
Constant Field Values

KNOWN

private static final java.lang.String[] KNOWN
Constructor Detail

ThemeManager

protected ThemeManager(javax.swing.JFrame frame)
Method Detail

isLookAndFeelOSX

public static boolean isLookAndFeelOSX()
Determine is the current look and feel is the OSX Aqua look and feel

Returns:
true if the OSX Aqua look and feel is being used

isLookAndFeelNimbus

public static boolean isLookAndFeelNimbus()

isLookAndFeelJGoodies

public static boolean isLookAndFeelJGoodies()

isLookAndFeelMotif

public static boolean isLookAndFeelMotif()

isLookAndFeelSubstance

public static boolean isLookAndFeelSubstance()

setTheme

private static void setTheme(java.lang.String theme)

setLookAndFeel

private static void setLookAndFeel(java.lang.String lookAndFeel)

buildLookAndFeelMenu

protected javax.swing.JMenu buildLookAndFeelMenu()
Loads the menu with the available look and feels for the application

Returns:
l and f menu

buildThemeList

private void buildThemeList()

addTheme

private void addTheme(java.lang.String theme)

buildThemeMenu

protected javax.swing.JMenu buildThemeMenu()

buildSubstanceMenu

protected javax.swing.JMenu buildSubstanceMenu()

refreshThemesState

private void refreshThemesState()

isLookAndFeelAvailable

private static boolean isLookAndFeelAvailable(java.lang.String laf)
A utility function that layers on top of the LookAndFeel's isSupportedLookAndFeel() method. Returns true if the LookAndFeel is supported. Returns false if the LookAndFeel is not supported and/or if there is any kind of error checking if the LookAndFeel is supported.

The L&F menu will use this method to determine whether the various L&F options should be active or inactive.

Parameters:
laf - name of look and feel to search for
Returns:
true if found

restartUI

private void restartUI()

reduceNimbusButtonMargin

public static void reduceNimbusButtonMargin(javax.swing.JButton button)
Reduce the margins around the content of a button for the Nimbus look and feel

Parameters:
button - button to alter

setSubstanceAnimationsEnabled

public static void setSubstanceAnimationsEnabled(boolean enabled)

isSubstanceAnimationsEnabled

public static boolean isSubstanceAnimationsEnabled()