home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / jfc.bin / OrganicLookAndFeel.java < prev    next >
Text File  |  1998-02-26  |  30KB  |  664 lines

  1. /*
  2.  * @(#)OrganicLookAndFeel.java    1.21 98/02/04
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.organic;
  22.  
  23. import java.awt.Font;
  24. import java.awt.Color;
  25. import java.awt.SystemColor;
  26.  
  27. import com.sun.java.swing.UIDefaults;
  28. import com.sun.java.swing.LookAndFeel;
  29. import com.sun.java.swing.plaf.*;
  30. import com.sun.java.swing.plaf.basic.*;
  31. import com.sun.java.swing.border.*;
  32. import com.sun.java.swing.BorderFactory;
  33. import com.sun.java.swing.JComponent;
  34. import com.sun.java.swing.ImageIcon;
  35.  
  36.  
  37. /**
  38.  * This class is used to define the UI classes and colors which 
  39.  * define the Java Look & Feel.
  40.  * <p>
  41.  * Warning: serialized objects of this class will not be compatible with
  42.  * future swing releases.  The current serialization support is appropriate
  43.  * for short term storage or RMI between Swing1.0 applications.  It will
  44.  * not be possible to load serialized Swing1.0 objects with future releases
  45.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  46.  * baseline for the serialized form of Swing objects.
  47.  *
  48.  * @version 1.21 02/04/98
  49.  * @author Steve Wilson
  50.  */
  51. public class OrganicLookAndFeel extends BasicLookAndFeel
  52.  
  53. {
  54.  
  55.     private static OrganicTheme currentTheme = new OrganicDefaultTheme();
  56.  
  57.     public String getName() {
  58.     return "Organic Look and Feel";
  59.     }
  60.  
  61.  
  62.     public String getID() {
  63.     return "Organic";
  64.     }
  65.  
  66.  
  67.     public String getDescription() {
  68.     return "Organic - A Cross-Platform Java Look and Feel";
  69.     }
  70.  
  71.     public boolean isNativeLookAndFeel(){
  72.         return false;
  73.     }
  74.  
  75.     public boolean isSupportedLookAndFeel() {
  76.         return true;
  77.     }
  78.  
  79.     public static void installColorsAndFont(JComponent c,
  80.                                          String defaultBgName,
  81.                                          String defaultFgName,
  82.                                          String defaultFontName) {
  83.         LookAndFeel.installColorsAndFont(c, defaultBgName, defaultFgName, defaultFontName);
  84.     }
  85.  
  86.    /** 
  87.      * Initialize the uiClassID to BasicComponentUI mapping.
  88.      * The JComponent classes define their own uiClassID constants
  89.      * (see AbstractComponent.getUIClassID).  This table must
  90.      * map those constants to a BasicComponentUI class of the
  91.      * appropriate type.
  92.      * 
  93.      * @see #getDefaults
  94.      */
  95.     protected void initClassDefaults(UIDefaults table)
  96.     {
  97.         
  98.     String basicPackageName = "com.sun.java.swing.plaf.basic.";
  99.     String organicPackageName = "com.sun.java.swing.plaf.organic.";
  100.     Object[] uiDefaults = {
  101.            "ButtonUI", organicPackageName + "OrganicButtonUI",
  102.          "CheckBoxUI", organicPackageName + "OrganicCheckBoxUI",
  103.              "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
  104.           "MenuBarUI", organicPackageName + "OrganicMenuBarUI",
  105.              "MenuUI", organicPackageName + "OrganicMenuUI",
  106.          "MenuItemUI", organicPackageName + "OrganicMenuItemUI",
  107.      "CheckBoxMenuItemUI", organicPackageName + "OrganicCheckBoxMenuItemUI",
  108.       "RadioButtonMenuItemUI", organicPackageName + "OrganicRadioButtonMenuItemUI",
  109.           "RadioButtonUI", organicPackageName + "OrganicRadioButtonUI",
  110.          "ToggleButtonUI", organicPackageName + "OrganicToggleButtonUI",
  111.         "PopupMenuUI", organicPackageName + "OrganicPopupMenuUI",
  112.           "ProgressBarUI", organicPackageName + "OrganicProgressBarUI",
  113.         "ScrollBarUI", organicPackageName + "OrganicScrollBarUI",
  114.            "ScrollPaneUI", organicPackageName + "OrganicScrollPaneUI",
  115.         "SplitPaneUI", organicPackageName + "OrganicSplitPaneUI",
  116.            "SliderUI", organicPackageName + "OrganicSliderUI",
  117.           "SpinnerUI", organicPackageName + "OrganicSpinnerUI",
  118.         "SeparatorUI", organicPackageName + "OrganicSeparatorUI",
  119.            "TabbedPaneUI", organicPackageName + "OrganicTabbedPaneUI",
  120.            "TextAreaUI", basicPackageName + "BasicTextAreaUI",  //don't need
  121.         "TextFieldUI", organicPackageName + "OrganicTextFieldUI",
  122.         "PasswordFieldUI", organicPackageName + "OrganicPasswordFieldUI",
  123.            "TextPaneUI", basicPackageName + "BasicTextPaneUI",  // don't need
  124.            "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
  125.              "TreeUI", organicPackageName + "OrganicTreeUI",
  126.             "LabelUI", organicPackageName + "OrganicLabelUI",
  127.            "ListUI", basicPackageName + "BasicListUI",  // don't need
  128.           "ToolBarUI", organicPackageName + "OrganicToolBarUI",
  129.           "ToolTipUI", organicPackageName + "OrganicToolTipUI",
  130.          "ComboBoxUI", organicPackageName + "OrganicComboBoxUI",
  131.             "TableUI", organicPackageName + "OrganicTableUI",
  132.           "TableHeaderUI", organicPackageName + "OrganicTableHeaderUI",
  133.         "InternalFrameUI", organicPackageName + "OrganicInternalFrameUI",
  134.        "StandardDialogUI", basicPackageName + "BasicStandardDialogUI",
  135.           "DesktopPaneUI", organicPackageName + "OrganicDesktopPaneUI",
  136.           "DesktopIconUI", organicPackageName + "OrganicDesktopIconUI",
  137.         "DirectoryPaneUI", organicPackageName + "OrganicDirectoryPaneUI",
  138.           "FileChooserUI", organicPackageName + "OrganicFileChooserUI",
  139.            "OptionPaneUI", organicPackageName + "OrganicOptionPaneUI"
  140.     };
  141.  
  142.     table.putDefaults(uiDefaults);
  143.     }
  144.  
  145.  
  146.     /**
  147.      * Load the SystemColors into the defaults table.  The keys
  148.      * for SystemColor defaults are the same as the names of
  149.      * the public fields in SystemColor.
  150.      */
  151.     protected void initSystemColorDefaults(UIDefaults table)
  152.     {
  153.     Object[] systemColors = {
  154.               "desktop", getDesktopColor(),
  155.         "activeCaption", getWindowTitleBackground(),
  156.          "activeCaptionText", getWindowTitleForeground(),
  157.       "activeCaptionBorder", getControl1(),
  158.           "inactiveCaption", getWindowTitleInactiveBackground(),
  159.       "inactiveCaptionText", getWindowTitleInactiveForeground(),
  160.     "inactiveCaptionBorder", getInactiveSystemTextColor(),
  161.                "window", getWindowBackground(),
  162.          "windowBorder", getBlack(),
  163.            "windowText", getWindowBackground(),
  164.              "menu", getMenuBackground(),
  165.              "menuText", getMenuForeground(),
  166.              "text", getControl1(),
  167.              "textText", getUserTextColor(),
  168.         "textHighlight", getTextHighlightColor(),
  169.         "textHighlightText", getHighlightedTextColor(),
  170.          "textInactiveText", getInactiveSystemTextColor(),
  171.               "control", getControl1(),
  172.           "controlText", getControlTextColor(),
  173.          "controlHighlight", getLightAccent1(),
  174.        "controlLtHighlight", getLightAccent1(), 
  175.         "controlShadow", getControl2(),
  176.           "controlDkShadow", getControl3(),
  177.             "scrollbar", getWindowBackground(),
  178.              "info", getHighlight4(),
  179.              "infoText", getWindowBackground() 
  180.     };
  181.  
  182.     for(int i = 0; i < systemColors.length; i += 2) {
  183.         table.put((String)systemColors[i], systemColors[i + 1]);
  184.     }
  185.     }
  186.  
  187.     protected void initComponentDefaults(UIDefaults table) 
  188.     {
  189.  
  190.  
  191.     FontUIResource monospacedPlain12 = new FontUIResource("Monospaced", 
  192.                                                           Font.PLAIN, 12);
  193.  
  194.  
  195.     Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
  196.         public Object createValue(UIDefaults table) { 
  197.         return new BasicListCellRenderer.UIResource();
  198.         }
  199.     };
  200.  
  201.     Object scrollPaneBorder =  BorderUIResource.getEtchedBorderUIResource();
  202.  
  203.     Object multilineTextBorder =  BasicMarginBorder.getMarginBorder();
  204.  
  205.     Object fieldTextBorder = new BorderUIResource( new OrganicTextBorder(getControl1()));
  206.  
  207.     Object activeFieldTextBorder = new BorderUIResource( new OrganicTextBorder(getWindowBackground()));
  208.  
  209.         Object toolTipBorder =new BorderUIResource(BorderFactory.createLineBorder(getWindowBackground(), 1));
  210.                                    
  211.     Object caretBlinkRate = new Integer(500);
  212.  
  213.     Object buttonBorder = new BorderUIResource( new CompoundBorder(
  214.                          new OrganicButtonBorder(),
  215.                          new OrganicButtonUI.OrganicButtonMargin()));
  216.  
  217.     Object buttonToggleBorder = new BorderUIResource( new CompoundBorder( 
  218.                      new OrganicToggleButtonUI.OrganicToggleButtonBorder(),
  219.                          new OrganicButtonUI.OrganicButtonMargin()));
  220.  
  221.     // *** ComboBox
  222.         Object comboBoxRendererActiveValue  = new UIDefaults.ActiveValue() {
  223.             public Object createValue(UIDefaults table) {
  224.                 return new BasicComboBoxRenderer.UIResource();
  225.             }
  226.         };
  227.  
  228.         Object comboBoxEditorActiveValue  = new UIDefaults.ActiveValue() {
  229.             public Object createValue(UIDefaults table) {
  230.                 return new OrganicComboBoxEditor.UIResource();
  231.             }
  232.         };
  233.  
  234.     Object menuItemMarginBorder = new BorderUIResource(new OrganicMenuItemBorder() );
  235.  
  236.     Object menuMarginBorder = new BorderUIResource(new OrganicMenuItemBorder() );
  237.  
  238.     Object menuBarBorder = new BorderUIResource(new OrganicMenuBarBorder());
  239.  
  240.     Object popupMenuBorder = new BorderUIResource(new OrganicPopupMenuBorder());
  241.  
  242.     Object titledBorderBorder = new BorderUIResource(new LineBorder(table.getColor("controlHighlight")));
  243.  
  244.     Object menuItemCheckIcon = OrganicIconFactory.getMenuItemCheckIcon();
  245.  
  246.     Object menuItemArrowIcon =  OrganicIconFactory.getMenuItemArrowIcon();
  247.  
  248.     Object menuArrowIcon = OrganicIconFactory.getMenuArrowIcon();
  249.  
  250.     Object checkBoxIcon = new OrganicCheckBoxIcon();
  251.  
  252.     Object radioButtonIcon = OrganicIconFactory.getRadioButtonIcon();
  253.  
  254.     Object checkBoxMenuItemIcon = OrganicIconFactory.getCheckBoxMenuItemIcon();
  255.  
  256.     Object radioButtonMenuItemIcon =  OrganicIconFactory.getRadioButtonMenuItemIcon();
  257.  
  258.     Object toolBarBorder = new BorderUIResource( new OrganicMenuBarBorder() );
  259.  
  260.     Object treeNodeClosedIcon =  OrganicIconFactory.getTreeNodeClosedIcon();
  261.  
  262.     Object treeNodeOpenIcon =  OrganicIconFactory.getTreeNodeOpenIcon();
  263.  
  264.     Object treeNodeLeafIcon = OrganicIconFactory.getTreeNodeLeafIcon();
  265.  
  266.     Object treeComputerIcon =  OrganicIconFactory.getTreeComputerIcon();
  267.  
  268.     Object treeHardDriveIcon = OrganicIconFactory.getTreeHardDriveIcon();
  269.  
  270.     Object treeFloppyDriveIcon = OrganicIconFactory.getTreeFloppyDriveIcon();
  271.  
  272.     Object treeExpandCollapseIcon = new OrganicTreeUI.ExpandCollapseIcon();
  273.  
  274.     Object fileChooserNewFolderIcon = OrganicIconFactory.getFileChooserNewFolderIcon();
  275.  
  276.     Object fileChooserUpFolderIcon =  OrganicIconFactory.getFileChooserUpFolderIcon();
  277.  
  278.     Object fileChooserHomeFolderIcon =  OrganicIconFactory.getFileChooserHomeFolderIcon();
  279.  
  280.     Object fileChooserDetailsViewIcon = OrganicIconFactory.getFileChooserDetailsViewIcon();
  281.  
  282.     Object fileChooserListViewIcon = OrganicIconFactory.getFileChooserListViewIcon();
  283.  
  284.     Object optionPaneBorder = new BorderUIResource( new CompoundBorder( 
  285.                          new MatteBorder( 2, 2, 2, 2, table.getColor("controlDkShadow") ),
  286.                          new EmptyBorder( 1, 1, 1, 1 ) ));
  287.  
  288.     Object listBorder = new BorderUIResource( new EmptyBorder( 6, 6, 6, 6 ));
  289.  
  290.  
  291.     Object internalFrameBorder = new BorderUIResource( new CompoundBorder(
  292.                      BorderFactory.createLineBorder(getLightAccent1(), 1),
  293.                              new OrganicFrameBorder( getWindowFrameLeft(),
  294.                                  getWindowFrameRight(),
  295.                                  getWindowFrameTop(),
  296.                                  getWindowFrameBottom(),
  297.                                  getWindowFrameInactive(),
  298.                                  2)) );
  299.  
  300.     Object internalPaletteFrameBorder = new BorderUIResource(
  301.                         new MatteBorder (2, 2, 2, 2, getHighlight4() ));
  302.  
  303.     Object focusCellHighlightBorder = new BorderUIResource( new LineBorder(getHighlight4()) );
  304.  
  305.     Object[] defaults = {
  306.         "Desktop.background", table.get("desktop"),
  307.  
  308.         "Panel.background", table.get("control"),
  309.         "Panel.foreground", table.get("textText"),
  310.         "Panel.font", getControlTextFont(),
  311.  
  312.         "Button.border", buttonBorder,
  313.         "Button.background", table.get("control"),
  314.         "Button.foreground", table.get("controlText"),
  315.         "Button.focus", getFocusColor(),
  316.         "Button.pressed",  table.get("controlShadow"),
  317.         "Button.disabled", table.get("controlShadow"),  
  318.         "Button.disabledText", table.get("textInactiveText"),       
  319.         "Button.font", getControlTextFont(),
  320.         "Button.highlight", table.get("controlLtHighlight"),
  321.         "Button.shadow", table.get("controlDkShadow"),
  322.  
  323.         "ToggleButton.border", buttonToggleBorder,
  324.         "ToggleButton.background", table.get("control"),
  325.         "ToggleButton.foreground", table.get("controlText"),
  326.         "ToggleButton.focus", getFocusColor(),
  327.         "ToggleButton.focusHighlight", getLightAccent1(),
  328.         "ToggleButton.selected",   table.get("controlShadow"),
  329.         "ToggleButton.disabled",   table.get("controlShadow"),  
  330.         "ToggleButton.disabledText", table.get("textInactiveText"),     
  331.         "ToggleButton.font", getControlTextFont(),
  332.  
  333.             "InternalFrame.icon", null,
  334.         "InternalFrame.border", internalFrameBorder,
  335.         "InternalFrame.paletteBorder", internalPaletteFrameBorder,        
  336.  
  337.         "InternalFrameTitlePane.activeBackground", table.get("activeCaption"),        
  338.         "InternalFrameTitlePane.inactiveBackground", table.get("inactiveCaption"),
  339.         "InternalFrameTitlePane.activeForeground",  table.get("activeCaptionText"),
  340.         "InternalFrameTitlePane.inactiveForeground",table.get("inactiveCaptionText"),
  341.         "InternalFrameTitlePane.paletteBackground", getPaletteTitleBackground(),        
  342.         "InternalFrameTitlePane.paletteForeground", getPaletteTitleForeground(),      
  343.         "InternalFrameTitlePane.font", getEmphasisTextFont(),
  344.         "InternalFrameTitlePane.maximizeIcon", OrganicIconFactory.createFrameMaximizeIcon(),
  345.         "InternalFrameTitlePane.iconizeIcon",  OrganicIconFactory.createFrameIconifyIcon(),
  346.         "InternalFrameTitlePane.closeIcon",  OrganicIconFactory.createFrameCloseIcon(),
  347.         "InternalFrameTitlePane.altMaximizeIcon", OrganicIconFactory.createFrameMinimizeIcon(),
  348.        
  349.         "RadioButton.background",  table.get("control"),
  350.         "RadioButton.foreground", table.get("controlText"),
  351.         "RadioButton.shadow", table.get("controlShadow"),
  352.         "RadioButton.darkShadow", table.get("controlDkShadow"),
  353.         "RadioButton.highlight", table.get("controlHighlight"),
  354.         "RadioButton.lightHighlight", getWhite(),
  355.         "RadioButton.dot", getBlack(),
  356.         "RadioButton.focus", getFocusColor(),
  357.         "RadioButton.font", getControlTextFont(),
  358.         "RadioButton.icon", radioButtonIcon,
  359.  
  360.         "CheckBox.icon", checkBoxIcon,
  361.  
  362.         "RadioButtonMenuItem.icon", radioButtonMenuItemIcon,
  363.         "CheckBoxMenuItem.icon", checkBoxMenuItemIcon,
  364.  
  365.         "Menu.border", menuMarginBorder,
  366.         "Menu.font", getMenuTextFont(),
  367.         "Menu.foreground", getMenuForeground(),
  368.         "Menu.pressedForeground", getMenuSelectedForeground(),
  369.         "Menu.subMenuForeground", getMenuItemForeground(),
  370.         "Menu.arrowIcon", menuArrowIcon,
  371.  
  372.         "MenuBar.border", menuBarBorder,
  373.         "MenuBar.background", table.get("menu"),
  374.         "MenuBar.foreground", table.get("menuText"),
  375.         "MenuBar.font", getMenuTextFont(),
  376.  
  377.         "MenuItem.border", menuItemMarginBorder,
  378.         "MenuItem.borderPainted", Boolean.FALSE,
  379.         "MenuItem.font", getMenuTextFont(),
  380.         "MenuItem.foreground", getMenuItemForeground(),
  381.         "MenuItem.disabledForeground", table.get("controlDkShadow"),
  382.         "MenuItem.background", table.get("menu"),
  383.         "MenuItem.pressedForeground", getMenuSelectedForeground(),
  384.         "MenuItem.pressedBackground", getMenuSelectedBackground(),
  385.         "MenuItem.acceleratorFont", getMenuTextFont(),
  386.         "MenuItem.acceleratorForeground", getMenuItemForeground(),
  387.         "MenuItem.acceleratorPressedForeground", getMenuSelectedForeground(),
  388.         "MenuItem.checkIcon", menuItemCheckIcon,
  389.         "MenuItem.arrowIcon", menuItemArrowIcon,
  390.  
  391.         "Separator.background", getMenuBackground(),
  392.         "Separator.foreground", getMenuSelectedBackground(),
  393.  
  394.         "PopupMenu.background", table.get("menu"),
  395.         "PopupMenu.border", popupMenuBorder,      
  396.  
  397.             "ComboBox.renderer", comboBoxRendererActiveValue,
  398.             "ComboBox.editor", comboBoxEditorActiveValue,
  399.             "ComboBox.background", table.get("control"),
  400.             "ComboBox.foreground", table.get("controlText"),
  401.             "ComboBox.selectedBackground", table.get("controlHighlight"),
  402.             "ComboBox.selectedForeground", table.get("controlText"),
  403.             "ComboBox.listBackground", table.get("control"),
  404.             "ComboBox.listForeground", table.get("controlText"),
  405.             "ComboBox.font", getControlTextFont(),
  406.  
  407.         "Label.font", getControlTextFont(),
  408.         "Label.background", table.get("text"),
  409.         "Label.foreground", getSystemTextColor(),
  410.         "Label.disabled", table.get("controlDkShadow"),
  411.  
  412.          "List.background", table.get("window"),
  413.         "List.foreground", table.get("controlText"),
  414.         "List.selectionBackground", table.get("control"), 
  415.         "List.selectionForeground", table.get("controlText"),
  416.         "List.focusCellHighlightBorder", focusCellHighlightBorder,
  417.         "List.font", getControlTextFont(),
  418.         "List.cellRenderer", listCellRendererActiveValue,
  419.         "List.border", listBorder,
  420.  
  421.         "TextField.caretForeground", getBlack(),
  422.         "TextField.caretBlinkRate", caretBlinkRate,
  423.         "TextField.inactiveForeground", table.get("textInactiveText"),
  424.         "TextField.selectionBackground", table.get("textHighlight"),
  425.         "TextField.selectionForeground", table.get("textHighlightText"),
  426.         "TextField.background", table.get("text"),
  427.         "TextField.foreground", table.get("textText"),
  428.         "TextField.font", getUserTextFont(),
  429.         "TextField.border", fieldTextBorder,
  430.         "TextField.activeBorder", activeFieldTextBorder,
  431.         "TextField.activeBackground", table.get("textHighlightText"),
  432.         
  433.         "ToolBar.border", toolBarBorder,
  434.         "ToolBar.background", table.get("menu"),
  435.         "ToolBar.foreground", table.get("menuText"),
  436.         "ToolBar.font", getControlTextFont(),
  437.  
  438.         "PasswordField.caretForeground", getBlack(),
  439.         "PasswordField.caretBlinkRate", caretBlinkRate,
  440.         "PasswordField.inactiveForeground", table.get("textInactiveText"),
  441.         "PasswordField.selectionBackground", table.get("textHighlight"),
  442.         "PasswordField.selectionForeground", table.get("textHighlightText"),
  443.         "PasswordField.background",  table.get("text"),
  444.         "PasswordField.foreground", table.get("textText"),
  445.         "PasswordField.font", monospacedPlain12,
  446.         "PasswordField.border", fieldTextBorder,
  447.         "PasswordField.activeBorder", activeFieldTextBorder,
  448.         "PasswordField.activeBackground", table.get("textHighlightText"),
  449.  
  450.         "ProgressBar.font", getControlTextFont(),
  451.         "ProgressBar.head", getLightAccent4(),
  452.         "ProgressBar.foreground",  getBlack(), 
  453.         "ProgressBar.background", table.get("controlShadow"),
  454.  
  455.         "SplitPane.background", table.get("control"),
  456.         "SplitPane.highlight", table.get("controlLtHighlight"),
  457.         "SplitPane.shadow", table.get("controlLtHighlight"),
  458.  
  459.             "TabbedPane.font", getControlTextFont(),
  460.             "TabbedPane.tabBackground", table.get("controlShadow"),
  461.             "TabbedPane.tabForeground", getControlTextColor(),
  462.             "TabbedPane.tabHighlight", table.get("controlHighlight"),
  463.             "TabbedPane.tabShadow", table.get("controlShadow"),
  464.             "TabbedPane.tabDarkShadow", table.get("controlDkShadow"),
  465.             "TabbedPane.focus", getFocusColor(),
  466.             "TabbedPane.selected", table.get("control"),
  467.         
  468.         "TextArea.caretForeground", getBlack(),
  469.         "TextArea.caretBlinkRate", caretBlinkRate,
  470.         "TextArea.inactiveForeground", table.get("textInactiveText"),
  471.         "TextArea.selectionBackground", table.get("textHighlight"),
  472.         "TextArea.selectionForeground", table.get("textHighlightText"),
  473.         "TextArea.background", table.get("window"),
  474.         "TextArea.foreground", table.get("textText"),
  475.         "TextArea.font", getUserTextFont(),
  476.         "TextArea.border", multilineTextBorder,
  477.         
  478.         "TextPane.caretForeground", getBlack(),
  479.         "TextPane.inactiveForeground", table.get("textInactiveText"),
  480.         "TextPane.selectionBackground",  table.get("textHighlight"),
  481.         "TextPane.selectionForeground", table.get("textHighlightText"),
  482.         "TextPane.background", table.get("window"),
  483.         "TextPane.foreground", table.get("textText"),
  484.         "TextPane.font", getUserTextFont(),
  485.         "TextPane.border", multilineTextBorder,
  486.         
  487.         "EditorPane.caretForeground", getBlack(),
  488.         "EditorPane.inactiveForeground", table.get("textInactiveText"),
  489.         "EditorPane.selectionBackground",  table.get("textHighlight"),
  490.         "EditorPane.selectionForeground", table.get("textHighlightText"),
  491.         "EditorPane.background", table.get("window"),
  492.         "EditorPane.foreground", table.get("textText"),
  493.         "EditorPane.font", getUserTextFont(),
  494.         "EditorPane.border", multilineTextBorder,
  495.         
  496.         "ScrollBar.background", table.get("scrollbar"),
  497.         "ScrollBar.track", table.get("scrollbar"),
  498.         "ScrollBar.trackHighlight", table.get("control"),
  499.         "ScrollBar.thumb", table.get("controlShadow"),
  500.         "ScrollBar.thumbHighlight", getDarkAccent4(),
  501.         "ScrollBar.border", null,
  502.         "ScrollBar.width", new Integer ( 9 ),
  503.  
  504.         "ScrollPane.border", null,
  505.         "ScrollPane.font", getControlTextFont(),
  506.         "ScrollPane.background", table.get("window"),
  507.         "ScrollPane.foreground", table.get("textText"),
  508.         "ScrollPane.viewportBorder", null,
  509.  
  510.         "Slider.border", null,
  511.         "Slider.foreground", table.get("controlShadow"),
  512.         "Slider.background", table.get("control"),
  513.         "Slider.highlight", table.get("controlLtHighlight"),
  514.         "Slider.darkShadow", table.get("controlDkShadow"),
  515.         "Slider.thumb", getDarkAccent4(),
  516.         "Slider.focus", getFocusColor(),
  517.  
  518.             "TitledBorder.font", getControlTextFont(),
  519.             "TitledBorder.titleColor", getSystemTextColor(),
  520.             "TitledBorder.border", titledBorderBorder,
  521.  
  522.             "ToolTip.font", getUserTextFont(),
  523.             "ToolTip.border", toolTipBorder,
  524.             "ToolTip.background", table.get("info"),
  525.             "ToolTip.foreground", table.get("infoText"),
  526.  
  527.         "Tree.background", table.get("window"),
  528.         "Tree.hash", table.get("control"),
  529.         "Tree.textSelectionColor", table.get("textHighlightText"),
  530.         "Tree.textNonSelectionColor", table.get("textText"),
  531.         "Tree.borderSelectionColor", table.get("controlShadow"),
  532.         "Tree.backgroundSelectionColor", table.get("textHighlight"),
  533.         "Tree.backgroundNonSelectionColor", table.get("window"),
  534.         "Tree.knobColor", getLightAccent4(),
  535.         "Tree.openIcon", treeNodeOpenIcon,
  536.         "Tree.closedIcon", treeNodeClosedIcon,
  537.         "Tree.leafIcon", treeNodeLeafIcon,
  538.         "Tree.computer", treeComputerIcon,
  539.         "Tree.hardDrive", treeHardDriveIcon,
  540.         "Tree.floppyDrive", treeFloppyDriveIcon,
  541.         "Tree.expandedIcon", treeExpandCollapseIcon,
  542.         "Tree.collapsedIcon", treeExpandCollapseIcon,
  543.  
  544.         "Table.font", getUserTextFont(),
  545.         "Table.foreground", table.get("textText"),  // cell text color
  546.         "Table.background", table.get("controlLtHighlight"),  // cell background color
  547.         "Table.selectionForeground", table.get("textText"),
  548.         "Table.selectionBackground", table.get("controlShadow"),
  549.         "Table.gridColor", getHighlight1(),  // grid line color
  550.         "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  551.         "Table.scrollPaneBorder", null,
  552.  
  553.         "TableHeader.font", getUserTextFont(), 
  554.         "TableHeader.foreground", getSystemTextColor(), // header text color
  555.         "TableHeader.background", table.get("control"), // header background
  556.  
  557.  
  558.         "FileChooser.newFolder", fileChooserNewFolderIcon,
  559.         "FileChooser.upFolder", fileChooserUpFolderIcon,
  560.         "FileChooser.homeFolder", fileChooserHomeFolderIcon,
  561.         "FileChooser.detailsView", fileChooserDetailsViewIcon,
  562.         "FileChooser.listView", fileChooserListViewIcon,
  563.  
  564.         "DirectoryPane.directoryIcon", treeNodeClosedIcon,
  565.         "DirectoryPane.fileIcon", treeNodeLeafIcon,
  566.         "DirectoryPane.computerIcon", treeComputerIcon,
  567.         "DirectoryPane.hardDriveIcon", treeHardDriveIcon,
  568.         "DirectoryPane.floppyDriveIcon", treeFloppyDriveIcon,
  569.  
  570.         "OptionPane.font", getControlTextFont(),
  571.         "OptionPane.background", table.get("control"),
  572.         "OptionPane.foreground", table.get("textText"),
  573.         "OptionPane.border", optionPaneBorder,        
  574.         "OptionPane.shadow", table.get("controlShadow"),
  575.         "OptionPane.darkShadow", table.get("controlDkShadow"),            
  576.         "OptionPane.errorIcon", LookAndFeel.makeIcon(getClass(), "icons/Error.gif"),
  577.         "OptionPane.informationIcon", LookAndFeel.makeIcon(getClass(), "icons/Inform.gif"),
  578.         "OptionPane.warningIcon", LookAndFeel.makeIcon(getClass(), "icons/Warn.gif"),
  579.         "OptionPane.questionIcon", LookAndFeel.makeIcon(getClass(), "icons/Question.gif")
  580.     };
  581.  
  582.     table.putDefaults(defaults);
  583.     }
  584.     public UIDefaults getDefaults() {
  585.     UIDefaults table = new UIDefaults();
  586.  
  587.     initClassDefaults(table);
  588.     initSystemColorDefaults(table);
  589.     initComponentDefaults(table);
  590.     currentTheme.addCustomEntriesToTable(table);
  591.     return table;
  592.     }
  593.     
  594.  
  595.  
  596.     public static void setCurrentTheme(OrganicTheme theme) {
  597.         if (theme == null) {
  598.         throw new NullPointerException("Can't have null theme");
  599.     }
  600.         currentTheme = theme;
  601.     }
  602.  
  603.     public static ColorUIResource getControl1() { return currentTheme.getControl1(); }
  604.     public static ColorUIResource getControl2() { return currentTheme.getControl2(); }
  605.     public static ColorUIResource getControl3() { return currentTheme.getControl3(); }
  606.     public static ColorUIResource getControl4() { return currentTheme.getControl4(); }
  607.  
  608.     public static ColorUIResource getHighlight1() { return currentTheme.getHighlight1(); }
  609.     public static ColorUIResource getHighlight2() { return currentTheme.getHighlight2(); }
  610.     public static ColorUIResource getHighlight3() { return currentTheme.getHighlight3(); }
  611.     public static ColorUIResource getHighlight4() { return currentTheme.getHighlight4(); }
  612.  
  613.     public static ColorUIResource getDarkAccent1() { return currentTheme.getDarkAccent1(); }
  614.     public static ColorUIResource getDarkAccent2() { return currentTheme.getDarkAccent2(); }
  615.     public static ColorUIResource getDarkAccent3() { return currentTheme.getDarkAccent3(); }
  616.     public static ColorUIResource getDarkAccent4() { return currentTheme.getDarkAccent4(); }
  617.  
  618.     public static ColorUIResource getLightAccent1() { return currentTheme.getLightAccent1(); }
  619.     public static ColorUIResource getLightAccent2() { return currentTheme.getLightAccent2(); }
  620.     public static ColorUIResource getLightAccent3() { return currentTheme.getLightAccent3(); }
  621.     public static ColorUIResource getLightAccent4() { return currentTheme.getLightAccent4(); }
  622.  
  623.     public static ColorUIResource getWhite() { return currentTheme.getWhite(); } 
  624.     public static ColorUIResource getBlack() { return currentTheme.getBlack(); }
  625.  
  626.     public static FontUIResource getControlTextFont() { return currentTheme.getControlTextFont();}
  627.     public static FontUIResource getUserTextFont() { return currentTheme.getUserTextFont();}
  628.     public static FontUIResource getMenuTextFont() { return currentTheme.getMenuTextFont();}
  629.     public static FontUIResource getEmphasisTextFont() { return currentTheme.getEmphasisTextFont();}
  630.  
  631.     public static ColorUIResource getDesktopColor() { return currentTheme.getDesktopColor(); }
  632.     public static ColorUIResource getFocusColor() { return currentTheme.getFocusColor(); }
  633.  
  634.  
  635.     public static ColorUIResource getSystemTextColor() { return currentTheme.getSystemTextColor(); }
  636.     public static ColorUIResource getControlTextColor() { return currentTheme.getControlTextColor(); }  
  637.     public static ColorUIResource getInactiveSystemTextColor() { return currentTheme.getInactiveSystemTextColor(); }
  638.     public static ColorUIResource getUserTextColor() { return currentTheme.getUserTextColor(); }
  639.     public static ColorUIResource getTextHighlightColor() { return currentTheme.getTextHighlightColor(); }
  640.     public static ColorUIResource getHighlightedTextColor() { return currentTheme.getHighlightedTextColor(); }
  641.  
  642.     public static ColorUIResource getWindowBackground() { return currentTheme.getWindowBackground(); }
  643.     public static ColorUIResource getWindowTitleBackground() { return currentTheme.getWindowTitleBackground(); }  
  644.     public static ColorUIResource getWindowTitleInactiveBackground() { return currentTheme.getWindowTitleInactiveBackground(); }
  645.     public static ColorUIResource getWindowTitleInactiveForeground() { return currentTheme.getWindowTitleInactiveForeground(); }
  646.     public static ColorUIResource getWindowTitleForeground() { return currentTheme.getWindowTitleForeground(); }
  647.     public static ColorUIResource getPaletteTitleBackground() { return currentTheme.getPaletteTitleBackground(); }
  648.     public static ColorUIResource getPaletteTitleForeground() { return currentTheme.getPaletteTitleForeground(); }
  649.     public static ColorUIResource getWindowFrameTop() { return currentTheme.getWindowFrameTop(); }   
  650.     public static ColorUIResource getWindowFrameBottom() { return currentTheme.getWindowFrameBottom(); }   
  651.     public static ColorUIResource getWindowFrameRight() { return currentTheme.getWindowFrameRight(); }   
  652.     public static ColorUIResource getWindowFrameLeft() { return currentTheme.getWindowFrameLeft(); }   
  653.     public static ColorUIResource getWindowFrameInactive() { return currentTheme.getWindowFrameInactive(); }   
  654.  
  655.     public static ColorUIResource getMenuBackground() { return currentTheme.getMenuBackground(); }
  656.     public static ColorUIResource getMenuForeground() { return  currentTheme.getMenuForeground(); }
  657.     public static ColorUIResource getMenuSelectedBackground() { return currentTheme.getMenuSelectedBackground(); }
  658.     public static ColorUIResource getMenuSelectedForeground() { return currentTheme.getMenuSelectedForeground(); }
  659.     public static ColorUIResource getMenuItemForeground() { return  currentTheme.getMenuItemForeground(); }
  660.     public static ColorUIResource getMenuItemSelectedForeground() { return  currentTheme.getMenuItemSelectedForeground(); }
  661.  
  662. }
  663.     
  664.