uic.themes
Class UICTheme

java.lang.Object
  extended byjavax.swing.plaf.metal.MetalTheme
      extended byjavax.swing.plaf.metal.DefaultMetalTheme
          extended byuic.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 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()

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

Parameters:
table - the table to be changed

getFocusColor

public ColorUIResource getFocusColor()

getDesktopColor

public ColorUIResource getDesktopColor()

getControl

public ColorUIResource getControl()

getControlShadow

public ColorUIResource getControlShadow()

getControlDarkShadow

public ColorUIResource getControlDarkShadow()

getControlInfo

public ColorUIResource getControlInfo()

getControlHighlight

public ColorUIResource getControlHighlight()

getControlDisabled

public ColorUIResource getControlDisabled()

getPrimaryControl

public ColorUIResource getPrimaryControl()

getPrimaryControlShadow

public ColorUIResource getPrimaryControlShadow()

getPrimaryControlDarkShadow

public ColorUIResource getPrimaryControlDarkShadow()

getPrimaryControlInfo

public ColorUIResource getPrimaryControlInfo()

getPrimaryControlHighlight

public ColorUIResource getPrimaryControlHighlight()

getSystemTextColor

public ColorUIResource getSystemTextColor()

getControlTextColor

public ColorUIResource getControlTextColor()

getInactiveControlTextColor

public ColorUIResource getInactiveControlTextColor()

getInactiveSystemTextColor

public ColorUIResource getInactiveSystemTextColor()

getUserTextColor

public ColorUIResource getUserTextColor()

getTextHighlightColor

public ColorUIResource getTextHighlightColor()

getHighlightedTextColor

public ColorUIResource getHighlightedTextColor()

getWindowBackground

public ColorUIResource getWindowBackground()

getWindowTitleBackground

public ColorUIResource getWindowTitleBackground()

getWindowTitleForeground

public ColorUIResource getWindowTitleForeground()

getWindowTitleInactiveBackground

public ColorUIResource getWindowTitleInactiveBackground()

getWindowTitleInactiveForeground

public ColorUIResource getWindowTitleInactiveForeground()

getMenuBackground

public ColorUIResource getMenuBackground()

getMenuForeground

public ColorUIResource getMenuForeground()

getMenuSelectedBackground

public ColorUIResource getMenuSelectedBackground()

getMenuSelectedForeground

public ColorUIResource getMenuSelectedForeground()

getMenuDisabledForeground

public ColorUIResource getMenuDisabledForeground()

getSeparatorBackground

public ColorUIResource getSeparatorBackground()

getSeparatorForeground

public ColorUIResource getSeparatorForeground()

getAcceleratorForeground

public ColorUIResource getAcceleratorForeground()

getAcceleratorSelectedForeground

public ColorUIResource getAcceleratorSelectedForeground()

getOddRow

public ColorUIResource getOddRow()

getEvenRow

public ColorUIResource getEvenRow()

getControlTextFont

public FontUIResource getControlTextFont()

getSystemTextFont

public FontUIResource getSystemTextFont()

getUserTextFont

public FontUIResource getUserTextFont()

getMenuTextFont

public FontUIResource getMenuTextFont()

getWindowTitleFont

public FontUIResource getWindowTitleFont()

getSubTextFont

public FontUIResource getSubTextFont()

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 Available under the Free Apache licence