uic.themes
Class UICTheme

java.lang.Object
  extended by javax.swing.plaf.metal.MetalTheme
      extended by javax.swing.plaf.metal.DefaultMetalTheme
          extended by uic.themes.UICTheme
Direct Known Subclasses:
UICThemeBigFonts

public class UICTheme
extends DefaultMetalTheme

The UICTheme for lots of usability fixes. Use this theme by setting it just before you create a JFrame or similar root window.

      // Set our theme to make it look better.
      try {
          //The following line is needed when starting the application from WebStart (only on Windows)
          javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new uic.themes.UICTheme());
          UIManager.setLookAndFeel(UIManager.getLookAndFeel());
      } catch(Exception e) {
          e.printStackTrace();
      }

      final JFrame frame = new JFrame("myTitle");
      try {
          Runnable r = new Runnable() {
              public void run() {
                  // update LaF for the toplevel frame, too
                  javax.swing.SwingUtilities.updateComponentTreeUI(frame);
              }
          };
          javax.swing.SwingUtilities.invokeLater(r);
      } catch (Exception e) {
          e.printStackTrace();
      } // end setting theme.

      // finish initialistion of frame.
      frame.setVisible(true);


Field Summary
protected static boolean dualButtonScrollBar
           
static boolean runningOnLinux
           
static boolean runningOnMacintosh
           
protected static boolean useAntiAlias
           
protected  Properties userSettings
           
 
Constructor Summary
UICTheme()
           
UICTheme(Properties userSettings)
           
 
Method Summary
 void addCustomEntriesToTable(UIDefaults table)
          Add changes to the table
 ColorUIResource getAcceleratorForeground()
           
 ColorUIResource getAcceleratorSelectedForeground()
           
static boolean getAntialiasEnabled()
          Check if global antialias is enabled.
 ColorUIResource getControl()
           
 ColorUIResource getControlDarkShadow()
           
 ColorUIResource getControlDisabled()
           
 ColorUIResource getControlHighlight()
           
 ColorUIResource getControlInfo()
           
 ColorUIResource getControlShadow()
           
 ColorUIResource getControlTextColor()
           
 FontUIResource getControlTextFont()
           
protected  Properties getDefaults()
          The hardcoded defaults for UICTheme are programmed here so its easy to alter them in extending classes.
 ColorUIResource getDesktopColor()
           
 ColorUIResource getEvenRow()
           
 ColorUIResource getFocusColor()
           
 ColorUIResource getHighlightedTextColor()
           
 ColorUIResource getInactiveControlTextColor()
           
 ColorUIResource getInactiveSystemTextColor()
           
 ColorUIResource getMenuBackground()
           
 ColorUIResource getMenuDisabledForeground()
           
 ColorUIResource getMenuForeground()
           
 ColorUIResource getMenuSelectedBackground()
           
 ColorUIResource getMenuSelectedForeground()
           
 FontUIResource getMenuTextFont()
           
 String getName()
           
 ColorUIResource getOddRow()
           
static Color getPartialColor(Color one, int percent)
          Mix a color from param 'one' to the default background color.
 ColorUIResource getPrimaryControl()
           
 ColorUIResource getPrimaryControlDarkShadow()
           
 ColorUIResource getPrimaryControlHighlight()
           
 ColorUIResource getPrimaryControlInfo()
           
 ColorUIResource getPrimaryControlShadow()
           
 ColorUIResource getSeparatorBackground()
           
 ColorUIResource getSeparatorForeground()
           
 FontUIResource getSubTextFont()
           
 ColorUIResource getSystemTextColor()
           
 FontUIResource getSystemTextFont()
           
 ColorUIResource getTextHighlightColor()
           
static boolean getUseDualButtonScrollBar()
          Check if the scrollbar button should have an up and down part in the bottom button.
protected  Color getUserColor(String name, String defaultColor)
           
protected  Font getUserFont(String name)
           
 Properties getUserSettings()
           
 ColorUIResource getUserTextColor()
           
 FontUIResource getUserTextFont()
           
 ColorUIResource getWindowBackground()
           
 ColorUIResource getWindowTitleBackground()
           
 FontUIResource getWindowTitleFont()
           
 ColorUIResource getWindowTitleForeground()
           
 ColorUIResource getWindowTitleInactiveBackground()
           
 ColorUIResource getWindowTitleInactiveForeground()
           
 void setAntialiasEnabled(boolean on)
          Turn antialias on or off for all widgets.
 void setUseDualButtonScrollBar(boolean on)
          Turn on using a double-button for the scrollbar.
 void setUserSettings(Properties settings)
           
 void store()
           
 
Methods inherited from class javax.swing.plaf.metal.DefaultMetalTheme
getPrimary1, getPrimary2, getPrimary3, getSecondary1, getSecondary2, getSecondary3
 
Methods inherited from class javax.swing.plaf.metal.MetalTheme
getBlack, getWhite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userSettings

protected Properties userSettings

useAntiAlias

protected static boolean useAntiAlias

dualButtonScrollBar

protected static boolean dualButtonScrollBar

runningOnMacintosh

public static final boolean runningOnMacintosh

runningOnLinux

public static final boolean runningOnLinux
Constructor Detail

UICTheme

public UICTheme()

UICTheme

public UICTheme(Properties userSettings)
Method Detail

getName

public String getName()
Overrides:
getName in class DefaultMetalTheme

getUserSettings

public Properties getUserSettings()

getUserColor

protected Color getUserColor(String name,
                             String defaultColor)

getUserFont

protected Font getUserFont(String name)

getDefaults

protected Properties getDefaults()
The hardcoded defaults for UICTheme are programmed here so its easy to alter them in extending classes. For example you can do:
  protected Properties getDefaults() {
      Properties defaults = super.getDefaults();
      defaults.put("color.oddrow", "#111111");
      return defaults;
  }


setUserSettings

public void setUserSettings(Properties settings)

addCustomEntriesToTable

public void addCustomEntriesToTable(UIDefaults table)
Add changes to the table

Overrides:
addCustomEntriesToTable in class MetalTheme
Parameters:
table - the table to be changed

getFocusColor

public ColorUIResource getFocusColor()
Overrides:
getFocusColor in class MetalTheme

getDesktopColor

public ColorUIResource getDesktopColor()
Overrides:
getDesktopColor in class MetalTheme

getControl

public ColorUIResource getControl()
Overrides:
getControl in class MetalTheme

getControlShadow

public ColorUIResource getControlShadow()
Overrides:
getControlShadow in class MetalTheme

getControlDarkShadow

public ColorUIResource getControlDarkShadow()
Overrides:
getControlDarkShadow in class MetalTheme

getControlInfo

public ColorUIResource getControlInfo()
Overrides:
getControlInfo in class MetalTheme

getControlHighlight

public ColorUIResource getControlHighlight()
Overrides:
getControlHighlight in class MetalTheme

getControlDisabled

public ColorUIResource getControlDisabled()
Overrides:
getControlDisabled in class MetalTheme

getPrimaryControl

public ColorUIResource getPrimaryControl()
Overrides:
getPrimaryControl in class MetalTheme

getPrimaryControlShadow

public ColorUIResource getPrimaryControlShadow()
Overrides:
getPrimaryControlShadow in class MetalTheme

getPrimaryControlDarkShadow

public ColorUIResource getPrimaryControlDarkShadow()
Overrides:
getPrimaryControlDarkShadow in class MetalTheme

getPrimaryControlInfo

public ColorUIResource getPrimaryControlInfo()
Overrides:
getPrimaryControlInfo in class MetalTheme

getPrimaryControlHighlight

public ColorUIResource getPrimaryControlHighlight()
Overrides:
getPrimaryControlHighlight in class MetalTheme

getSystemTextColor

public ColorUIResource getSystemTextColor()
Overrides:
getSystemTextColor in class MetalTheme

getControlTextColor

public ColorUIResource getControlTextColor()
Overrides:
getControlTextColor in class MetalTheme

getInactiveControlTextColor

public ColorUIResource getInactiveControlTextColor()
Overrides:
getInactiveControlTextColor in class MetalTheme

getInactiveSystemTextColor

public ColorUIResource getInactiveSystemTextColor()
Overrides:
getInactiveSystemTextColor in class MetalTheme

getUserTextColor

public ColorUIResource getUserTextColor()
Overrides:
getUserTextColor in class MetalTheme

getTextHighlightColor

public ColorUIResource getTextHighlightColor()
Overrides:
getTextHighlightColor in class MetalTheme

getHighlightedTextColor

public ColorUIResource getHighlightedTextColor()
Overrides:
getHighlightedTextColor in class MetalTheme

getWindowBackground

public ColorUIResource getWindowBackground()
Overrides:
getWindowBackground in class MetalTheme

getWindowTitleBackground

public ColorUIResource getWindowTitleBackground()
Overrides:
getWindowTitleBackground in class MetalTheme

getWindowTitleForeground

public ColorUIResource getWindowTitleForeground()
Overrides:
getWindowTitleForeground in class MetalTheme

getWindowTitleInactiveBackground

public ColorUIResource getWindowTitleInactiveBackground()
Overrides:
getWindowTitleInactiveBackground in class MetalTheme

getWindowTitleInactiveForeground

public ColorUIResource getWindowTitleInactiveForeground()
Overrides:
getWindowTitleInactiveForeground in class MetalTheme

getMenuBackground

public ColorUIResource getMenuBackground()
Overrides:
getMenuBackground in class MetalTheme

getMenuForeground

public ColorUIResource getMenuForeground()
Overrides:
getMenuForeground in class MetalTheme

getMenuSelectedBackground

public ColorUIResource getMenuSelectedBackground()
Overrides:
getMenuSelectedBackground in class MetalTheme

getMenuSelectedForeground

public ColorUIResource getMenuSelectedForeground()
Overrides:
getMenuSelectedForeground in class MetalTheme

getMenuDisabledForeground

public ColorUIResource getMenuDisabledForeground()
Overrides:
getMenuDisabledForeground in class MetalTheme

getSeparatorBackground

public ColorUIResource getSeparatorBackground()
Overrides:
getSeparatorBackground in class MetalTheme

getSeparatorForeground

public ColorUIResource getSeparatorForeground()
Overrides:
getSeparatorForeground in class MetalTheme

getAcceleratorForeground

public ColorUIResource getAcceleratorForeground()
Overrides:
getAcceleratorForeground in class MetalTheme

getAcceleratorSelectedForeground

public ColorUIResource getAcceleratorSelectedForeground()
Overrides:
getAcceleratorSelectedForeground in class MetalTheme

getOddRow

public ColorUIResource getOddRow()

getEvenRow

public ColorUIResource getEvenRow()

getControlTextFont

public FontUIResource getControlTextFont()
Overrides:
getControlTextFont in class DefaultMetalTheme

getSystemTextFont

public FontUIResource getSystemTextFont()
Overrides:
getSystemTextFont in class DefaultMetalTheme

getUserTextFont

public FontUIResource getUserTextFont()
Overrides:
getUserTextFont in class DefaultMetalTheme

getMenuTextFont

public FontUIResource getMenuTextFont()
Overrides:
getMenuTextFont in class DefaultMetalTheme

getWindowTitleFont

public FontUIResource getWindowTitleFont()
Overrides:
getWindowTitleFont in class DefaultMetalTheme

getSubTextFont

public FontUIResource getSubTextFont()
Overrides:
getSubTextFont in class DefaultMetalTheme

setAntialiasEnabled

public void setAntialiasEnabled(boolean on)
Turn antialias on or off for all widgets.

Since:
1.1

setUseDualButtonScrollBar

public void setUseDualButtonScrollBar(boolean on)
Turn on using a double-button for the scrollbar.

Since:
2.0

getAntialiasEnabled

public static boolean getAntialiasEnabled()
Check if global antialias is enabled. Note that this is a static due to implementation details of Swing, this means that you can not configure antialias per theme, the last change is for the whole JVM.

Since:
1.1

getUseDualButtonScrollBar

public static boolean getUseDualButtonScrollBar()
Check if the scrollbar button should have an up and down part in the bottom button.

Since:
2.0

getPartialColor

public static Color getPartialColor(Color one,
                                    int percent)
Mix a color from param 'one' to the default background color. Using the configured background color of the theme (which is white by default) mix a new color that is completely the background at 0% and completely the argument color at 100%.

Parameters:
one - the mix color
percent - the percentage to move from the background to param 'one'.

store

public void store()


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence