uic.themes
Class UICTheme

java.lang.Object
  |
  +--javax.swing.plaf.metal.MetalTheme
        |
        +--javax.swing.plaf.metal.DefaultMetalTheme
              |
              +--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();
      }

      try {
          final JFrame frame = new JFrame("myTitle");
          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.show();

This them not only changes colors and look and feel, but also fixes some problems on how widgets behave, this should not influence your application; but those fixes are needed for the layouter used in UICompiler to do its job.
See the SwingBugs text file for a list of problems detected while writing UICompiler.


Field Summary
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()
           
 ColorUIResource getPrimaryControl()
           
 ColorUIResource getPrimaryControlDarkShadow()
           
 ColorUIResource getPrimaryControlHighlight()
           
 ColorUIResource getPrimaryControlInfo()
           
 ColorUIResource getPrimaryControlShadow()
           
 ColorUIResource getSeparatorBackground()
           
 ColorUIResource getSeparatorForeground()
           
 FontUIResource getSubTextFont()
           
 ColorUIResource getSystemTextColor()
           
 FontUIResource getSystemTextFont()
           
 ColorUIResource getTextHighlightColor()
           
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 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
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

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

store

public void store()


Copyright © 2002,2003 Thomas Zander