FileDocCategorySizeDatePackage
OceanTheme.javaAPI DocJava SE 5 API15963Fri Aug 26 14:58:08 BST 2005javax.swing.plaf.metal

OceanTheme

public class OceanTheme extends DefaultMetalTheme
This class provides an updated look for applications using MetalLookAndFeel. The designers of the Metal Look and Feel strive to keep the default look up to date, possibly through the use of new themes in the future. Therefore, developers should only use this class directly when they wish to customize the "Ocean" look, or force it to be the current theme, regardless of future updates.
version
1.16 01/04/05
since
1.5
see
MetalLookAndFeel#setCurrentTheme

Fields Summary
private static final ColorUIResource
PRIMARY1
private static final ColorUIResource
PRIMARY2
private static final ColorUIResource
PRIMARY3
private static final ColorUIResource
SECONDARY1
private static final ColorUIResource
SECONDARY2
private static final ColorUIResource
SECONDARY3
private static final ColorUIResource
CONTROL_TEXT_COLOR
private static final ColorUIResource
INACTIVE_CONTROL_TEXT_COLOR
private static final ColorUIResource
MENU_DISABLED_FOREGROUND
private static final ColorUIResource
OCEAN_BLACK
Constructors Summary
public OceanTheme()
Construct an instance of OceanTheme

    
Methods Summary
public voidaddCustomEntriesToTable(javax.swing.UIDefaults table)
Add this theme's custom entries to the defaults table.

param
table the defaults table, non-null
throws
NullPointerException if the parameter is null

        Object focusBorder = new UIDefaults.ProxyLazyValue(
                      "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
                      new Object[] {getPrimary1()});
        // .30 0 DDE8F3 white secondary2
        java.util.List buttonGradient = Arrays.asList(
                 new Object[] {new Float(.3f), new Float(0f),
                 new ColorUIResource(0xDDE8F3), getWhite(), getSecondary2() });

        // Other possible properties that aren't defined:
        //
        // Used when generating the disabled Icons, provides the region to
        // constrain grays to.
        // Button.disabledGrayRange -> Object[] of Integers giving min/max
        // InternalFrame.inactiveTitleGradient -> Gradient when the
        //   internal frame is inactive.
        Color cccccc = new ColorUIResource(0xCCCCCC);
        Color dadada = new ColorUIResource(0xDADADA);
        Color c8ddf2 = new ColorUIResource(0xC8DDF2);
        Object directoryIcon = getIconResource("icons/ocean/directory.gif");
        Object fileIcon = getIconResource("icons/ocean/file.gif");
        java.util.List sliderGradient = Arrays.asList(new Object[] {
            new Float(.3f), new Float(.2f),
            c8ddf2, getWhite(), new ColorUIResource(SECONDARY2) });

        Object[] defaults = new Object[] {
            "Button.gradient", buttonGradient,
            "Button.rollover", Boolean.TRUE,
            "Button.toolBarBorderBackground", INACTIVE_CONTROL_TEXT_COLOR, 
            "Button.disabledToolBarBorderBackground", cccccc,
            "Button.rolloverIconType", "ocean",

            "CheckBox.rollover", Boolean.TRUE,
            "CheckBox.gradient", buttonGradient,

            "CheckBoxMenuItem.gradient", buttonGradient,

            // home2
            "FileChooser.homeFolderIcon",
                 getIconResource("icons/ocean/homeFolder.gif"),
            // directory2
            "FileChooser.newFolderIcon",
                 getIconResource("icons/ocean/newFolder.gif"),
            // updir2
            "FileChooser.upFolderIcon",
                 getIconResource("icons/ocean/upFolder.gif"),

            // computer2
            "FileView.computerIcon",
                 getIconResource("icons/ocean/computer.gif"),
            "FileView.directoryIcon", directoryIcon,
            // disk2
            "FileView.hardDriveIcon",
                 getIconResource("icons/ocean/hardDrive.gif"),
            "FileView.fileIcon", fileIcon,
            // floppy2
            "FileView.floppyDriveIcon",
                 getIconResource("icons/ocean/floppy.gif"),

            "Label.disabledForeground", getInactiveControlTextColor(),
            
            "Menu.opaque", Boolean.FALSE,

            "MenuBar.gradient", Arrays.asList(new Object[] {
                     new Float(1f), new Float(0f),
                     getWhite(), dadada, 
                     new ColorUIResource(dadada) }),
            "MenuBar.borderColor", cccccc,

            "InternalFrame.activeTitleGradient", buttonGradient,
            // close2
            "InternalFrame.closeIcon",
                     new UIDefaults.LazyValue() {
                         public Object createValue(UIDefaults table) {
                             return new IFIcon(getHastenedIcon("icons/ocean/close.gif", table),
                                               getHastenedIcon("icons/ocean/close-pressed.gif", table));
                         }
                     },
            // minimize
            "InternalFrame.iconifyIcon",
                     new UIDefaults.LazyValue() {
                         public Object createValue(UIDefaults table) {
                             return new IFIcon(getHastenedIcon("icons/ocean/iconify.gif", table),
                                               getHastenedIcon("icons/ocean/iconify-pressed.gif", table));
                         }
                     },
            // restore
            "InternalFrame.minimizeIcon",
                     new UIDefaults.LazyValue() {
                         public Object createValue(UIDefaults table) {
                             return new IFIcon(getHastenedIcon("icons/ocean/minimize.gif", table),
                                               getHastenedIcon("icons/ocean/minimize-pressed.gif", table));
                         }
                     },
            // menubutton3
            "InternalFrame.icon",
                     getIconResource("icons/ocean/menu.gif"),
            // maximize2
            "InternalFrame.maximizeIcon",
                     new UIDefaults.LazyValue() {
                         public Object createValue(UIDefaults table) {
                             return new IFIcon(getHastenedIcon("icons/ocean/maximize.gif", table),
                                               getHastenedIcon("icons/ocean/maximize-pressed.gif", table));
                         }
                     },
            // paletteclose
            "InternalFrame.paletteCloseIcon",
                     new UIDefaults.LazyValue() {
                         public Object createValue(UIDefaults table) {
                             return new IFIcon(getHastenedIcon("icons/ocean/paletteClose.gif", table),
                                               getHastenedIcon("icons/ocean/paletteClose-pressed.gif", table));
                         }
                     },

            "List.focusCellHighlightBorder", focusBorder,

            "MenuBarUI", "javax.swing.plaf.metal.MetalMenuBarUI",

            "OptionPane.errorIcon",
                   getIconResource("icons/ocean/error.png"),
            "OptionPane.informationIcon",
                   getIconResource("icons/ocean/info.png"),
            "OptionPane.questionIcon",
                   getIconResource("icons/ocean/question.png"),
            "OptionPane.warningIcon",
                   getIconResource("icons/ocean/warning.png"),

            "RadioButton.gradient", buttonGradient,
            "RadioButton.rollover", Boolean.TRUE,

            "RadioButtonMenuItem.gradient", buttonGradient,

            "ScrollBar.gradient", buttonGradient,

            "Slider.altTrackColor", new ColorUIResource(0xD2E2EF),
            "Slider.gradient", sliderGradient,
            "Slider.focusGradient", sliderGradient,

            "SplitPane.oneTouchButtonsOpaque", Boolean.FALSE,
            "SplitPane.dividerFocusColor", c8ddf2,

            "TabbedPane.borderHightlightColor", getPrimary1(),
            "TabbedPane.contentAreaColor", c8ddf2,
            "TabbedPane.contentBorderInsets", new Insets(4, 2, 3, 3),
            "TabbedPane.selected", c8ddf2,
            "TabbedPane.tabAreaBackground", dadada,
            "TabbedPane.tabAreaInsets", new Insets(2, 2, 0, 6),
            "TabbedPane.unselectedBackground", SECONDARY3,

            "Table.focusCellHighlightBorder", focusBorder,
            "Table.gridColor", SECONDARY1,

            "ToggleButton.gradient", buttonGradient,

            "ToolBar.borderColor", cccccc,
            "ToolBar.isRollover", Boolean.TRUE,

            "Tree.closedIcon", directoryIcon,

            "Tree.collapsedIcon",
                  new UIDefaults.LazyValue() {
                      public Object createValue(UIDefaults table) {
                          return new COIcon(getHastenedIcon("icons/ocean/collapsed.gif", table),
                                            getHastenedIcon("icons/ocean/collapsed-rtl.gif", table));
                      }
                  },

            "Tree.expandedIcon",
                  getIconResource("icons/ocean/expanded.gif"),
            "Tree.leafIcon", fileIcon,
            "Tree.openIcon", directoryIcon,
            "Tree.selectionBorderColor", getPrimary1()
        };
        table.putDefaults(defaults);
    
protected javax.swing.plaf.ColorUIResourcegetBlack()
Return the color that the Metal Look and Feel should use as "Black". The Look and Feel will use this color in painting as it sees fit. This color does not necessarily synch up with the typical concept of black, nor is it necessarily used for all black items.

return
the "Black" color.

        return OCEAN_BLACK;
    
public javax.swing.plaf.ColorUIResourcegetControlTextColor()
Return the color that the Metal Look and Feel should use as the default color for controls. The Look and Feel will use this color in painting as it sees fit.

return
the "Control Text" color.

        return CONTROL_TEXT_COLOR;
    
public javax.swing.plaf.ColorUIResourcegetDesktopColor()
Return the color that the Metal Look and Feel should use for the desktop background. The Look and Feel will use this color in painting as it sees fit.

return
the "Desktop" color.

        return MetalTheme.white;
    
private javax.swing.IcongetHastenedIcon(java.lang.String iconID, javax.swing.UIDefaults table)

        Object res = getIconResource(iconID);
        return (Icon)((UIDefaults.LazyValue)res).createValue(table);
    
private java.lang.ObjectgetIconResource(java.lang.String iconID)

        return SwingUtilities2.makeIcon(getClass(), OceanTheme.class, iconID);
    
public javax.swing.plaf.ColorUIResourcegetInactiveControlTextColor()
Return the color that the Metal Look and Feel should use as the default color for inactive controls. The Look and Feel will use this color in painting as it sees fit.

return
the "Inactive Control Text" color.

        return INACTIVE_CONTROL_TEXT_COLOR;
    
public javax.swing.plaf.ColorUIResourcegetMenuDisabledForeground()
Return the color that the Metal Look and Feel should use as the foreground color for disabled menu items. The Look and Feel will use this color in painting as it sees fit.

return
the "Menu Disabled Foreground" color.

        return MENU_DISABLED_FOREGROUND;
    
public java.lang.StringgetName()
Return the name of this theme, "Ocean".

return
"Ocean"

        return "Ocean";
    
protected javax.swing.plaf.ColorUIResourcegetPrimary1()
Return the color that the Metal Look and Feel should use as "Primary 1". The Look and Feel will use this color in painting as it sees fit.

return
the "Primary 1" color.

        return PRIMARY1;
    
protected javax.swing.plaf.ColorUIResourcegetPrimary2()
Return the color that the Metal Look and Feel should use as "Primary 2". The Look and Feel will use this color in painting as it sees fit.

return
the "Primary 2" color.

        return PRIMARY2;
    
protected javax.swing.plaf.ColorUIResourcegetPrimary3()
Return the color that the Metal Look and Feel should use as "Primary 3". The Look and Feel will use this color in painting as it sees fit.

return
the "Primary 3" color.

        return PRIMARY3;
    
protected javax.swing.plaf.ColorUIResourcegetSecondary1()
Return the color that the Metal Look and Feel should use as "Secondary 1". The Look and Feel will use this color in painting as it sees fit.

return
the "Secondary 1" color.

        return SECONDARY1;
    
protected javax.swing.plaf.ColorUIResourcegetSecondary2()
Return the color that the Metal Look and Feel should use as "Secondary 2". The Look and Feel will use this color in painting as it sees fit.

return
the "Secondary 2" color.

        return SECONDARY2;
    
protected javax.swing.plaf.ColorUIResourcegetSecondary3()
Return the color that the Metal Look and Feel should use as "Secondary 3". The Look and Feel will use this color in painting as it sees fit.

return
the "Secondary 3" color.

        return SECONDARY3;
    
booleanisSystemTheme()
Overriden to enable picking up the system fonts, if applicable.

        return true;