Source for javax.swing.plaf.metal.MetalLookAndFeel

   1: /* MetalLookAndFeel.java
   2:    Copyright (C) 2002, 2005 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.swing.plaf.metal;
  40: 
  41: import java.awt.Color;
  42: import java.awt.Font;
  43: import java.awt.Insets;
  44: 
  45: import javax.swing.LookAndFeel;
  46: import javax.swing.UIDefaults;
  47: import javax.swing.UIManager;
  48: import javax.swing.plaf.BorderUIResource;
  49: import javax.swing.plaf.ColorUIResource;
  50: import javax.swing.plaf.FontUIResource;
  51: import javax.swing.plaf.InsetsUIResource;
  52: import javax.swing.plaf.BorderUIResource.LineBorderUIResource;
  53: import javax.swing.plaf.basic.BasicLookAndFeel;
  54: 
  55: 
  56: /**
  57:  * A custom look and feel that is designed to look similar across different
  58:  * operating systems.
  59:  */
  60: public class MetalLookAndFeel extends BasicLookAndFeel
  61: {       
  62:   private static final long serialVersionUID = 6680646159193457980L;
  63:   
  64:   /** The current theme. */
  65:   private static MetalTheme theme;
  66:   
  67:   /** The look and feel defaults. */
  68:   private UIDefaults LAF_defaults;
  69: 
  70:   /**
  71:    * Creates a new instance of the Metal look and feel.
  72:    */
  73:   public MetalLookAndFeel()
  74:   {
  75:     if (theme == null)
  76:       createDefaultTheme();
  77:   }
  78: 
  79:   /**
  80:    * Sets the current theme to a new instance of {@link DefaultMetalTheme}.
  81:    */
  82:   protected void createDefaultTheme()
  83:   {
  84:     setCurrentTheme(new DefaultMetalTheme());
  85:   }
  86: 
  87:   /**
  88:    * Returns <code>false</code> to indicate that this look and feel does not
  89:    * attempt to emulate the look and feel of native applications on the host
  90:    * platform.
  91:    * 
  92:    * @return <code>false</code>.
  93:    */
  94:   public boolean isNativeLookAndFeel()
  95:   {
  96:     return false;
  97:   }
  98: 
  99:   /**
 100:    * Returns <code>true</code> to indicate that this look and feel is supported
 101:    * on all platforms.
 102:    * 
 103:    * @return <code>true</code>.
 104:    */
 105:   public boolean isSupportedLookAndFeel()
 106:   {
 107:     return true;
 108:   }
 109: 
 110:   /**
 111:    * Returns a string describing the look and feel.  In this case, the method
 112:    * returns "Metal look and feel".
 113:    * 
 114:    * @return A string describing the look and feel.
 115:    */
 116:   public String getDescription()
 117:   {
 118:     return "Metal look and feel";
 119:   }
 120: 
 121:   /**
 122:    * Returns the look and feel identifier.
 123:    * 
 124:    * @return "MetalLookAndFeel".
 125:    */
 126:   public String getID()
 127:   {
 128:     return "MetalLookAndFeel";
 129:   }
 130: 
 131:   /**
 132:    * Returns the look and feel name.
 133:    * 
 134:    * @return "MetalLookAndFeel".
 135:    */
 136:   public String getName()
 137:   {
 138:     return "MetalLookAndFeel";
 139:   }
 140: 
 141:   public UIDefaults getDefaults()
 142:   {
 143:     if (LAF_defaults == null)
 144:       {
 145:         LAF_defaults = super.getDefaults();
 146: 
 147:         // add custom theme entries to the table
 148:         theme.addCustomEntriesToTable(LAF_defaults);
 149:       }
 150:     
 151:     // Returns the default values for this look and feel. 
 152:     return LAF_defaults;
 153:   }
 154: 
 155:   /**
 156:    * Returns the accelerator foreground color from the installed theme.
 157:    * 
 158:    * @return The accelerator foreground color.
 159:    */
 160:   public static ColorUIResource getAcceleratorForeground()
 161:   {
 162:     return theme.getAcceleratorForeground();
 163:   }
 164: 
 165:   /**
 166:    * Returns the accelerator selected foreground color from the installed 
 167:    * theme.
 168:    * 
 169:    * @return The accelerator selected foreground color.
 170:    */
 171:   public static ColorUIResource getAcceleratorSelectedForeground()
 172:   {
 173:     return theme.getAcceleratorSelectedForeground();
 174:   }
 175: 
 176:   /**
 177:    * Returns the color black from the installed theme.
 178:    * 
 179:    * @return The color black.
 180:    */
 181:   public static ColorUIResource getBlack()
 182:   {
 183:     return theme.getBlack();
 184:   }
 185: 
 186:   /**
 187:    * Returns the control color from the installed theme.
 188:    * 
 189:    * @return The control color.
 190:    */
 191:   public static ColorUIResource getControl()
 192:   {
 193:     return theme.getControl();
 194:   }
 195: 
 196:   /**
 197:    * Returns the color used for dark shadows on controls, from the installed
 198:    * theme.
 199:    * 
 200:    * @return The color used for dark shadows on controls.
 201:    */
 202:   public static ColorUIResource getControlDarkShadow()
 203:   {
 204:     return theme.getControlDarkShadow();
 205:   }
 206: 
 207:   /**
 208:    * Returns the color used for disabled controls, from the installed theme.
 209:    * 
 210:    * @return The color used for disabled controls.
 211:    */
 212:   public static ColorUIResource getControlDisabled()
 213:   {
 214:     return theme.getControlDisabled();
 215:   }
 216: 
 217:   /**
 218:    * Returns the color used to draw highlights for controls, from the installed
 219:    * theme.
 220:    * 
 221:    * @return The color used to draw highlights for controls.
 222:    */
 223:   public static ColorUIResource getControlHighlight()
 224:   {
 225:     return theme.getControlHighlight();
 226:   }
 227: 
 228:   /**
 229:    * Returns the color used to display control info, from the installed 
 230:    * theme.
 231:    * 
 232:    * @return The color used to display control info.
 233:    */
 234:   public static ColorUIResource getControlInfo()
 235:   {
 236:     return theme.getControlInfo();
 237:   }
 238: 
 239:   /**
 240:    * Returns the color used to draw shadows for controls, from the installed
 241:    * theme.
 242:    * 
 243:    * @return The color used to draw shadows for controls.
 244:    */
 245:   public static ColorUIResource getControlShadow()
 246:   {
 247:     return theme.getControlShadow();
 248:   }
 249: 
 250:   /**
 251:    * Returns the color used for text on controls, from the installed theme.
 252:    * 
 253:    * @return The color used for text on controls.
 254:    */
 255:   public static ColorUIResource getControlTextColor()
 256:   {
 257:     return theme.getControlTextColor();
 258:   }
 259: 
 260:   /**
 261:    * Returns the font used for text on controls, from the installed theme.
 262:    * 
 263:    * @return The font used for text on controls.
 264:    */
 265:   public static FontUIResource getControlTextFont()
 266:   {
 267:     return theme.getControlTextFont();
 268:   }
 269: 
 270:   /**
 271:    * Returns the color used for the desktop background, from the installed 
 272:    * theme.
 273:    * 
 274:    * @return The color used for the desktop background.
 275:    */
 276:   public static ColorUIResource getDesktopColor()
 277:   {
 278:     return theme.getDesktopColor();
 279:   }
 280: 
 281:   /**
 282:    * Returns the color used to draw focus highlights, from the installed 
 283:    * theme.
 284:    * 
 285:    * @return The color used to draw focus highlights.
 286:    */
 287:   public static ColorUIResource getFocusColor()
 288:   {
 289:     return theme.getFocusColor();
 290:   }
 291: 
 292:   /**
 293:    * Returns the color used to draw highlighted text, from the installed
 294:    * theme.
 295:    * 
 296:    * @return The color used to draw highlighted text.
 297:    */
 298:   public static ColorUIResource getHighlightedTextColor()
 299:   {
 300:     return theme.getHighlightedTextColor();
 301:   }
 302: 
 303:   /**
 304:    * Returns the color used to draw text on inactive controls, from the
 305:    * installed theme.
 306:    * 
 307:    * @return The color used to draw text on inactive controls.
 308:    */
 309:   public static ColorUIResource getInactiveControlTextColor()
 310:   {
 311:     return theme.getInactiveControlTextColor();
 312:   }
 313: 
 314:   /**
 315:    * Returns the color used to draw inactive system text, from the installed
 316:    * theme.
 317:    * 
 318:    * @return The color used to draw inactive system text.
 319:    */
 320:   public static ColorUIResource getInactiveSystemTextColor()
 321:   {
 322:     return theme.getInactiveSystemTextColor();
 323:   }
 324: 
 325:   /**
 326:    * Returns the background color for menu items, from the installed theme.
 327:    * 
 328:    * @return The background color for menu items.
 329:    * 
 330:    * @see #getMenuSelectedBackground()
 331:    */
 332:   public static ColorUIResource getMenuBackground()
 333:   {
 334:     return theme.getMenuBackground();
 335:   }
 336: 
 337:   /**
 338:    * Returns the foreground color for disabled menu items, from the installed
 339:    * theme.
 340:    * 
 341:    * @return The foreground color for disabled menu items.
 342:    * 
 343:    * @see #getMenuForeground()
 344:    */
 345:   public static ColorUIResource getMenuDisabledForeground()
 346:   {
 347:     return theme.getMenuDisabledForeground();
 348:   }
 349: 
 350:   /**
 351:    * Returns the foreground color for menu items, from the installed theme.
 352:    * 
 353:    * @return The foreground color for menu items.
 354:    * 
 355:    * @see #getMenuDisabledForeground()
 356:    * @see #getMenuSelectedForeground()
 357:    */
 358:   public static ColorUIResource getMenuForeground()
 359:   {
 360:     return theme.getMenuForeground();
 361:   }
 362: 
 363:   /**
 364:    * Returns the background color for selected menu items, from the installed
 365:    * theme.
 366:    * 
 367:    * @return The background color for selected menu items.
 368:    * 
 369:    * @see #getMenuBackground()
 370:    */
 371:   public static ColorUIResource getMenuSelectedBackground()
 372:   {
 373:     return theme.getMenuSelectedBackground();
 374:   }
 375: 
 376:   /**
 377:    * Returns the foreground color for selected menu items, from the installed
 378:    * theme.
 379:    * 
 380:    * @return The foreground color for selected menu items.
 381:    * 
 382:    * @see #getMenuForeground()
 383:    */
 384:   public static ColorUIResource getMenuSelectedForeground()
 385:   {
 386:     return theme.getMenuSelectedForeground();
 387:   }
 388: 
 389:   /**
 390:    * Returns the font used for text in menus, from the installed theme.
 391:    * 
 392:    * @return The font used for text in menus.
 393:    */
 394:   public static FontUIResource getMenuTextFont()
 395:   {
 396:     return theme.getMenuTextFont();
 397:   }
 398: 
 399:   /**
 400:    * Returns the primary color for controls, from the installed theme.
 401:    * 
 402:    * @return The primary color for controls.
 403:    */
 404:   public static ColorUIResource getPrimaryControl()
 405:   {
 406:     return theme.getPrimaryControl();
 407:   }
 408: 
 409:   /**
 410:    * Returns the primary color for the dark shadow on controls, from the 
 411:    * installed theme.
 412:    * 
 413:    * @return The primary color for the dark shadow on controls.
 414:    */
 415:   public static ColorUIResource getPrimaryControlDarkShadow()
 416:   {
 417:     return theme.getPrimaryControlDarkShadow();
 418:   }
 419: 
 420:   /**
 421:    * Returns the primary color for the highlight on controls, from the 
 422:    * installed theme.
 423:    * 
 424:    * @return The primary color for the highlight on controls.
 425:    */
 426:   public static ColorUIResource getPrimaryControlHighlight()
 427:   {
 428:     return theme.getPrimaryControlHighlight();
 429:   }
 430: 
 431:   /**
 432:    * Returns the primary color for the information on controls, from the 
 433:    * installed theme.
 434:    * 
 435:    * @return The primary color for the information on controls.
 436:    */
 437:   public static ColorUIResource getPrimaryControlInfo()
 438:   {
 439:     return theme.getPrimaryControlInfo();
 440:   }
 441: 
 442:   /**
 443:    * Returns the primary color for the shadow on controls, from the installed
 444:    * theme.
 445:    * 
 446:    * @return The primary color for the shadow on controls.
 447:    */
 448:   public static ColorUIResource getPrimaryControlShadow()
 449:   {
 450:     return theme.getPrimaryControlShadow();
 451:   }
 452: 
 453:   /**
 454:    * Returns the background color for separators, from the installed theme.
 455:    * 
 456:    * @return The background color for separators.
 457:    */
 458:   public static ColorUIResource getSeparatorBackground()
 459:   {
 460:     return theme.getSeparatorBackground();
 461:   }
 462: 
 463:   /**
 464:    * Returns the foreground color for separators, from the installed theme.
 465:    * 
 466:    * @return The foreground color for separators.
 467:    */
 468:   public static ColorUIResource getSeparatorForeground()
 469:   {
 470:     return theme.getSeparatorForeground();
 471:   }
 472: 
 473:   /**
 474:    * Returns the font used for sub text, from the installed theme.
 475:    * 
 476:    * @return The font used for sub text.
 477:    */
 478:   public static FontUIResource getSubTextFont()
 479:   {
 480:     return theme.getSubTextFont();
 481:   }
 482: 
 483:   /**
 484:    * Returns the color used for system text, from the installed theme.
 485:    * 
 486:    * @return The color used for system text.
 487:    */
 488:   public static ColorUIResource getSystemTextColor()
 489:   {
 490:     return theme.getSystemTextColor();
 491:   }
 492: 
 493:   /**
 494:    * Returns the font used for system text, from the installed theme.
 495:    * 
 496:    * @return The font used for system text.
 497:    */
 498:   public static FontUIResource getSystemTextFont()
 499:   {
 500:     return theme.getSystemTextFont();
 501:   }
 502: 
 503:   /**
 504:    * Returns the color used to highlight text, from the installed theme.
 505:    * 
 506:    * @return The color used to highlight text.
 507:    */
 508:   public static ColorUIResource getTextHighlightColor()
 509:   {
 510:     return theme.getTextHighlightColor();
 511:   }
 512: 
 513:   /**
 514:    * Returns the color used to display user text, from the installed theme.
 515:    * 
 516:    * @return The color used to display user text.
 517:    */
 518:   public static ColorUIResource getUserTextColor()
 519:   {
 520:     return theme.getUserTextColor();
 521:   }
 522: 
 523:   /**
 524:    * Returns the font used for user text, obtained from the current theme.
 525:    * 
 526:    * @return The font used for user text.
 527:    */
 528:   public static FontUIResource getUserTextFont()
 529:   {
 530:     return theme.getUserTextFont();
 531:   }
 532: 
 533:   /**
 534:    * Returns the color used for white, from the installed theme.
 535:    * 
 536:    * @return The color used for white.
 537:    */
 538:   public static ColorUIResource getWhite()
 539:   {
 540:     return theme.getWhite();
 541:   }
 542: 
 543:   /**
 544:    * Returns the window background color, from the installed theme.
 545:    * 
 546:    * @return The window background color.
 547:    */
 548:   public static ColorUIResource getWindowBackground()
 549:   {
 550:     return theme.getWindowBackground();
 551:   }
 552: 
 553:   /**
 554:    * Returns the window title background color, from the installed theme.
 555:    * 
 556:    * @return The window title background color.
 557:    */
 558:   public static ColorUIResource getWindowTitleBackground()
 559:   {
 560:     return theme.getWindowTitleBackground();
 561:   }
 562: 
 563:   /**
 564:    * Returns the window title font from the current theme.
 565:    * 
 566:    * @return The window title font.
 567:    * 
 568:    * @see MetalTheme
 569:    */
 570:   public static FontUIResource getWindowTitleFont()
 571:   {
 572:     return theme.getWindowTitleFont();
 573:   }
 574: 
 575:   /**
 576:    * Returns the window title foreground color, from the installed theme.
 577:    * 
 578:    * @return The window title foreground color.
 579:    */
 580:   public static ColorUIResource getWindowTitleForeground()
 581:   {
 582:     return theme.getWindowTitleForeground();
 583:   }
 584: 
 585:   /**
 586:    * Returns the background color for an inactive window title, from the 
 587:    * installed theme.
 588:    * 
 589:    * @return The background color for an inactive window title.
 590:    */
 591:   public static ColorUIResource getWindowTitleInactiveBackground()
 592:   {
 593:     return theme.getWindowTitleInactiveBackground();
 594:   }
 595: 
 596:   /**
 597:    * Returns the foreground color for an inactive window title, from the 
 598:    * installed theme.
 599:    * 
 600:    * @return The foreground color for an inactive window title.
 601:    */
 602:   public static ColorUIResource getWindowTitleInactiveForeground()
 603:   {
 604:     return theme.getWindowTitleInactiveForeground();
 605:   }
 606: 
 607:   /**
 608:    * Sets the current theme for the look and feel.  Note that the theme must be 
 609:    * set <em>before</em> the look and feel is installed.  To change the theme 
 610:    * for an already running application that is using the 
 611:    * {@link MetalLookAndFeel}, first set the theme with this method, then 
 612:    * create a new instance of {@link MetalLookAndFeel} and install it in the 
 613:    * usual way (see {@link UIManager#setLookAndFeel(LookAndFeel)}).
 614:    * 
 615:    * @param theme  the theme (<code>null</code> not permitted).
 616:    * 
 617:    * @throws NullPointerException if <code>theme</code> is <code>null</code>.
 618:    */
 619:   public static void setCurrentTheme(MetalTheme theme)
 620:   {
 621:     if (theme == null)
 622:       throw new NullPointerException("Null 'theme' not permitted.");
 623:     MetalLookAndFeel.theme = theme;
 624:   }
 625: 
 626:   /**
 627:    * Sets the ComponentUI classes for all Swing components to the Metal
 628:    * implementations.
 629:    *
 630:    * In particular this sets the following keys:
 631:    *
 632:    * <table>
 633:    * <tr>
 634:    * <th>Key</th><th>Value</th>
 635:    * </tr><tr>
 636:    * <td>ButtonUI</td><td>{@link MetalButtonUI}</td>
 637:    * </tr><tr>
 638:    * <td>CheckBoxUI</td><td>{@link MetalCheckBoxUI}</td>
 639:    * </tr><tr>
 640:    * <td>ComboBoxUI</td><td>{@link MetalComboBoxUI}</td>
 641:    * </tr><tr>
 642:    * <td>DesktopIconUI</td><td>{@link MetalDesktopIconUI}</td>
 643:    * </tr><tr>
 644:    * <td>InternalFrameUI</td><td>{@link MetalInternalFrameUI}</td>
 645:    * </tr><tr>
 646:    * <td>LabelUI</td><td>{@link MetalLabelUI}</td>
 647:    * </tr><tr>
 648:    * <td>PopupMenuSeparatorUI</td><td>{@link MetalPopupMenuSeparatorUI}</td>
 649:    * </tr><tr>
 650:    * <td>ProgressBarUI</td><td>{@link MetalProgressBarUI}</td>
 651:    * </tr><tr>
 652:    * <td>RadioButtonUI</td><td>{@link MetalRadioButtonUI}</td>
 653:    * </tr><tr>
 654:    * <td>RootPaneUI</td><td>{@link MetalRootPaneUI}</td>
 655:    * </tr><tr>
 656:    * <td>ScrollBarUI</td><td>{@link MetalScrollBarUI}</td>
 657:    * </tr><tr>
 658:    * <td>ScrollPaneUI</td><td>{@link MetalScrollPaneUI}</td>
 659:    * </tr><tr>
 660:    * <td>SeparatorUI</td><td>{@link MetalSeparatorUI}</td>
 661:    * </tr><tr>
 662:    * <td>SliderUI</td><td>{@link MetalSliderUI}</td>
 663:    * </tr><tr>
 664:    * <td>SplitPaneUI</td><td>{@link MetalSplitPaneUI}</td>
 665:    * </tr><tr>
 666:    * <td>TabbedPaneUI</td><td>{@link MetalTabbedPaneUI}</td>
 667:    * </tr><tr>
 668:    * <td>TextFieldUI</td><td>{@link MetalTextFieldUI}</td>
 669:    * </tr><tr>
 670:    * <td>ToggleButtonUI</td><td>{@link MetalToggleButtonUI}</td>
 671:    * </tr><tr>
 672:    * <td>ToolBarUI</td><td>{@link MetalToolBarUI}</td>
 673:    * </tr><tr>
 674:    * <td>ToolTipUI</td><td>{@link MetalToolTipUI}</td>
 675:    * </tr><tr>
 676:    * <td>TreeUI</td><td>{@link MetalTreeUI}</td>
 677:    * </tr><tr>
 678:    * </table>
 679:    *
 680:    * @param defaults the UIDefaults where the class defaults are added
 681:    */
 682:   protected void initClassDefaults(UIDefaults defaults)
 683:   {
 684:     super.initClassDefaults(defaults);
 685: 
 686:     // Variables
 687:     Object[] uiDefaults;
 688:     // Initialize Class Defaults
 689:     uiDefaults = new Object[] {
 690:       "ButtonUI", "javax.swing.plaf.metal.MetalButtonUI",
 691:       "CheckBoxUI", "javax.swing.plaf.metal.MetalCheckBoxUI",
 692:       "ComboBoxUI", "javax.swing.plaf.metal.MetalComboBoxUI",
 693:       "DesktopIconUI", "javax.swing.plaf.metal.MetalDesktopIconUI",
 694:       "InternalFrameUI", "javax.swing.plaf.metal.MetalInternalFrameUI",
 695:       "LabelUI", "javax.swing.plaf.metal.MetalLabelUI",
 696:       "PopupMenuSeparatorUI",
 697:       "javax.swing.plaf.metal.MetalPopupMenuSeparatorUI",
 698:       "ProgressBarUI", "javax.swing.plaf.metal.MetalProgressBarUI",
 699:       "RadioButtonUI", "javax.swing.plaf.metal.MetalRadioButtonUI",
 700:       "RootPaneUI", "javax.swing.plaf.metal.MetalRootPaneUI",
 701:       "ScrollBarUI", "javax.swing.plaf.metal.MetalScrollBarUI",
 702:       "ScrollPaneUI", "javax.swing.plaf.metal.MetalScrollPaneUI",
 703:       "SeparatorUI", "javax.swing.plaf.metal.MetalSeparatorUI",
 704:       "SliderUI", "javax.swing.plaf.metal.MetalSliderUI",
 705:       "SplitPaneUI", "javax.swing.plaf.metal.MetalSplitPaneUI",
 706:       "TabbedPaneUI", "javax.swing.plaf.metal.MetalTabbedPaneUI",
 707:       "TextFieldUI", "javax.swing.plaf.metal.MetalTextFieldUI",
 708:       "ToggleButtonUI", "javax.swing.plaf.metal.MetalToggleButtonUI",
 709:       "ToolBarUI", "javax.swing.plaf.metal.MetalToolBarUI",
 710:       "ToolTipUI", "javax.swing.plaf.metal.MetalToolTipUI",
 711:       "TreeUI", "javax.swing.plaf.metal.MetalTreeUI",
 712:     };
 713:     // Add Class Defaults to UI Defaults table
 714:     defaults.putDefaults(uiDefaults);
 715:   }
 716: 
 717:   /**
 718:    * Initializes the component defaults for the Metal Look &amp; Feel.
 719:    *
 720:    * In particular this sets the following keys (the colors are given
 721:    * as RGB hex values):
 722:    *
 723:    * <table>
 724:    * <tr>
 725:    * <th>Key</th><th>Value</th>
 726:    * </tr><tr>
 727:    * <td>Button.background</td><td>0xcccccc</td>
 728:    * </tr><tr>
 729:    * <td>Button.border</td><td>{@link MetalBorders#getButtonBorder()}</td>
 730:    * </tr><tr>
 731:    * <td>Button.font</td><td>{@link #getControlTextFont}</td>
 732:    * </tr><tr>
 733:    * <td>Button.margin</td><td><code>new java.awt.Insets(2, 14, 2, 14)</code>
 734:    * </td>
 735:    * </tr><tr>
 736:    * <td>CheckBox.background</td><td>0xcccccc</td>
 737:    * </tr><tr>
 738:    * <td>CheckBoxMenuItem.background</td><td>0xcccccc</td>
 739:    * </tr><tr>
 740:    * <td>ToolBar.background</td><td>0xcccccc</td>
 741:    * </tr><tr>
 742:    * <td>Panel.background</td><td>0xcccccc</td>
 743:    * </tr><tr>
 744:    * <td>Slider.background</td><td>0xcccccc</td>
 745:    * </tr><tr>
 746:    * <td>OptionPane.background</td><td>0xcccccc</td>
 747:    * </tr><tr>
 748:    * <td>ProgressBar.background</td><td>0xcccccc</td>
 749:    * </tr><tr>
 750:    * <td>TabbedPane.background</td><td>0xcccccc</td>
 751:    * </tr><tr>
 752:    * <td>Label.background</td><td>0xcccccc</td>
 753:    * </tr><tr>
 754:    * <td>Label.font</td><td>{@link #getControlTextFont}</td>
 755:    * </tr><tr>
 756:    * <td>Menu.background</td><td>0xcccccc</td>
 757:    * </tr><tr>
 758:    * <td>MenuBar.background</td><td>0xcccccc</td>
 759:    * </tr><tr>
 760:    * <td>MenuItem.background</td><td>0xcccccc</td>
 761:    * </tr><tr>
 762:    * <td>ScrollBar.background</td><td>0xcccccc</td>
 763:    * </tr><tr>
 764:    * <td>PopupMenu.border</td>
 765:    * <td><code>new javax.swing.plaf.metal.MetalBorders.PopupMenuBorder()</td>
 766:    * </tr><tr>
 767:    * </table>
 768:    *
 769:    * @param defaults the UIDefaults instance to which the values are added
 770:    */
 771:   protected void initComponentDefaults(UIDefaults defaults)
 772:   {
 773:     super.initComponentDefaults(defaults);
 774:     Object[] myDefaults = new Object[] {
 775:       "Button.background", getControl(),
 776:       "Button.border", MetalBorders.getButtonBorder(),
 777:       "Button.darkShadow", getControlDarkShadow(),
 778:       "Button.disabledText", getInactiveControlTextColor(),
 779:       "Button.focus", getFocusColor(),
 780:       "Button.font", getControlTextFont(),
 781:       "Button.foreground", getControlTextColor(),
 782:       "Button.highlight", getControlHighlight(),
 783:       "Button.light", getControlHighlight(),
 784:       "Button.margin", new InsetsUIResource(2, 14, 2, 14),
 785:       "Button.select", getControlShadow(),
 786:       "Button.shadow", getControlShadow(),
 787: 
 788:       "CheckBox.background", getControl(),
 789:       "CheckBox.border", MetalBorders.getButtonBorder(),
 790:       "CheckBox.disabledText", getInactiveControlTextColor(),
 791:       "CheckBox.focus", getFocusColor(),
 792:       "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
 793:       "CheckBox.foreground", getControlTextColor(),
 794:       "CheckBox.icon",
 795:       new UIDefaults.ProxyLazyValue
 796:           ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
 797:       "CheckBox.checkIcon",
 798:       new UIDefaults.ProxyLazyValue
 799:       ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
 800:       "Checkbox.select", getControlShadow(),
 801: 
 802:       "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
 803:       "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
 804:       "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
 805:       "CheckBoxMenuItem.background", getMenuBackground(),
 806:       "CheckBoxMenuItem.borderPainted", new Boolean(true),
 807:       "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
 808:       "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
 809:       "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
 810:       "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12),
 811:       "CheckBoxMenuItem.foreground", getMenuForeground(),
 812:       "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
 813:       "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
 814: 
 815:       "ColorChooser.background", getControl(),
 816:       "ColorChooser.foreground", getControlTextColor(),
 817:       "ColorChooser.rgbBlueMnemonic", new Integer(0),
 818:       "ColorChooser.rgbGreenMnemonic", new Integer(0),
 819:       "ColorChooser.rgbRedMnemonic", new Integer(0),
 820:       "ColorChooser.swatchesDefaultRecentColor", getControl(),
 821: 
 822:       "ComboBox.background", getControl(),
 823:       "ComboBox.buttonBackground", getControl(),
 824:       "ComboBox.buttonDarkShadow", getControlDarkShadow(),
 825:       "ComboBox.buttonHighlight", getControlHighlight(),
 826:       "ComboBox.buttonShadow", getControlShadow(),
 827:       "ComboBox.disabledBackground", getControl(),
 828:       "ComboBox.disabledForeground", getInactiveSystemTextColor(),
 829:       "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
 830:       "ComboBox.foreground", getControlTextColor(),
 831:       "ComboBox.selectionBackground", getPrimaryControlShadow(),
 832:       "ComboBox.selectionForeground", getControlTextColor(),
 833: 
 834:       "Desktop.background", getDesktopColor(),
 835: 
 836:       "DesktopIcon.background", getControl(),
 837:       "DesktopIcon.foreground", getControlTextColor(),
 838:       "DesktopIcon.width", new Integer(160),
 839:       "DesktopIcon.border", MetalBorders.getDesktopIconBorder(),
 840: 
 841:       "EditorPane.background", getWindowBackground(),
 842:       "EditorPane.caretForeground", getUserTextColor(),
 843:       "EditorPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
 844:       "EditorPane.foreground",  getUserTextColor(),
 845:       "EditorPane.inactiveForeground",  getInactiveSystemTextColor(),
 846:       "EditorPane.selectionBackground", getTextHighlightColor(),
 847:       "EditorPane.selectionForeground", getHighlightedTextColor(),
 848:       
 849:       "FormattedTextField.background", getWindowBackground(),
 850:       "FormattedTextField.border",
 851:       new BorderUIResource(MetalBorders.getTextFieldBorder()),
 852:       "FormattedTextField.caretForeground", getUserTextColor(),
 853:       "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
 854:       "FormattedTextField.foreground",  getUserTextColor(),
 855:       "FormattedTextField.inactiveBackground",  getControl(),
 856:       "FormattedTextField.inactiveForeground",  getInactiveSystemTextColor(),
 857:       "FormattedTextField.selectionBackground", getTextHighlightColor(),
 858:       "FormattedTextField.selectionForeground", getHighlightedTextColor(),
 859: 
 860:       "FileView.computerIcon", MetalIconFactory.getTreeComputerIcon(),
 861:       "FileView.directoryIcon", MetalIconFactory.getTreeFolderIcon(),
 862:       "FileView.fileIcon", MetalIconFactory.getTreeLeafIcon(),
 863:       "FileView.floppyDriveIcon", MetalIconFactory.getTreeFloppyDriveIcon(),
 864:       "FileView.hardDriveIcon", MetalIconFactory.getTreeHardDriveIcon(),
 865: 
 866:       "InternalFrame.activeTitleBackground", getWindowTitleBackground(),
 867:       "InternalFrame.activeTitleForeground", getWindowTitleForeground(),
 868:       "InternalFrame.border", new MetalBorders.InternalFrameBorder(),
 869:       "InternalFrame.borderColor", getControl(),
 870:       "InternalFrame.borderDarkShadow", getControlDarkShadow(),
 871:       "InternalFrame.borderHighlight", getControlHighlight(),
 872:       "InternalFrame.borderLight", getControlHighlight(),
 873:       "InternalFrame.borderShadow", getControlShadow(),
 874:       "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
 875:       "InternalFrame.closeIcon", 
 876:         MetalIconFactory.getInternalFrameCloseIcon(16),
 877:       "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(),
 878:       "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(),
 879:       "InternalFrame.maximizeIcon", 
 880:         MetalIconFactory.getInternalFrameMaximizeIcon(16),
 881:       "InternalFrame.iconifyIcon", 
 882:         MetalIconFactory.getInternalFrameMinimizeIcon(16),
 883:       "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(),
 884:       "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(),
 885:       "InternalFrame.paletteTitleHeight", new Integer(11),
 886: 
 887:       "Label.background", getControl(),
 888:       "Label.disabledForeground", getInactiveSystemTextColor(),
 889:       "Label.disabledShadow", getControlShadow(),
 890:       "Label.font", getControlTextFont(),
 891:       "Label.foreground", getSystemTextColor(),
 892: 
 893:       "List.font", getControlTextFont(),
 894:       "List.background", getWindowBackground(),
 895:       "List.foreground", getUserTextColor(),
 896:       "List.selectionBackground", getTextHighlightColor(),
 897:       "List.selectionForeground", getHighlightedTextColor(),
 898:       "List.focusCellHighlightBorder", 
 899:         new LineBorderUIResource(MetalLookAndFeel.getFocusColor()),
 900: 
 901:       "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
 902:       "Menu.acceleratorForeground", getAcceleratorForeground(),
 903:       "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
 904:       "Menu.background", getMenuBackground(),
 905:       "Menu.border", new MetalBorders.MenuItemBorder(),
 906:       "Menu.borderPainted", Boolean.TRUE,
 907:       "Menu.disabledForeground", getMenuDisabledForeground(),
 908:       "Menu.font", getControlTextFont(),
 909:       "Menu.foreground", getMenuForeground(),
 910:       "Menu.selectionBackground", getMenuSelectedBackground(),
 911:       "Menu.selectionForeground", getMenuSelectedForeground(),
 912: 
 913:       "MenuBar.background", getMenuBackground(),
 914:       "MenuBar.border", new MetalBorders.MenuBarBorder(),
 915:       "MenuBar.font", getControlTextFont(),
 916:       "MenuBar.foreground", getMenuForeground(),
 917:       "MenuBar.highlight", getControlHighlight(),
 918:       "MenuBar.shadow", getControlShadow(),
 919: 
 920:       "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
 921:       "MenuItem.acceleratorForeground", getAcceleratorForeground(),
 922:       "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
 923:       "MenuItem.background", getMenuBackground(),
 924:       "MenuItem.border", new MetalBorders.MenuItemBorder(),
 925:       "MenuItem.disabledForeground", getMenuDisabledForeground(),
 926:       "MenuItem.font", getControlTextFont(),
 927:       "MenuItem.foreground", getMenuForeground(),
 928:       "MenuItem.selectionBackground", getMenuSelectedBackground(),
 929:       "MenuItem.selectionForeground", getMenuSelectedForeground(),
 930: 
 931:       "OptionPane.background", getControl(),
 932:       "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51), 
 933:       "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153),
 934:       "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0),
 935:       "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102),
 936:       "OptionPane.foreground", getControlTextColor(),
 937:       "OptionPane.messageForeground", getControlTextColor(),
 938:       "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51),
 939:       "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153),
 940:       "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0),
 941:       "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102),
 942:       "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51),
 943:       "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153),
 944:       "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0),
 945:       "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102),
 946: 
 947:       "Panel.background", getControl(),
 948:       "Panel.foreground", getUserTextColor(),
 949: 
 950:       "PasswordField.background", getWindowBackground(),
 951:       "PasswordField.border",
 952:       new BorderUIResource(MetalBorders.getTextFieldBorder()),
 953:       "PasswordField.caretForeground", getUserTextColor(),
 954:       "PasswordField.foreground", getUserTextColor(),
 955:       "PasswordField.inactiveBackground", getControl(),
 956:       "PasswordField.inactiveForeground", getInactiveSystemTextColor(),
 957:       "PasswordField.selectionBackground", getTextHighlightColor(),
 958:       "PasswordField.selectionForeground", getHighlightedTextColor(),
 959: 
 960:       "PopupMenu.background", getMenuBackground(),
 961:       "PopupMenu.border", new MetalBorders.PopupMenuBorder(),
 962:       "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12),
 963:       "PopupMenu.foreground", getMenuForeground(),
 964: 
 965:       "ProgressBar.background", getControl(),
 966:       "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
 967:       "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
 968:       "ProgressBar.foreground", getPrimaryControlShadow(),
 969:       "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
 970:       "ProgressBar.selectionForeground", getControl(),
 971: 
 972:       "RadioButton.background", getControl(),
 973:       "RadioButton.darkShadow", getControlDarkShadow(),
 974:       "RadioButton.disabledText", getInactiveControlTextColor(),
 975:       "RadioButton.icon",
 976:       new UIDefaults.LazyValue()
 977:       {
 978:         public Object createValue(UIDefaults def)
 979:           {
 980:             return MetalIconFactory.getRadioButtonIcon();
 981:           }
 982:       },
 983:       "RadioButton.focus", MetalLookAndFeel.getFocusColor(),
 984:       "RadioButton.font", MetalLookAndFeel.getControlTextFont(),
 985:       "RadioButton.foreground", getControlTextColor(),
 986:       "RadioButton.highlight", getControlHighlight(),
 987:       "RadioButton.light", getControlHighlight(),
 988:       "RadioButton.select", getControlShadow(),
 989:       "RadioButton.shadow", getControlShadow(),
 990: 
 991:       "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10),
 992:       "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
 993:       "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
 994:       "RadioButtonMenuItem.background", getMenuBackground(),
 995:       "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
 996:       "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
 997:       "RadioButtonMenuItem.checkIcon", 
 998:         MetalIconFactory.getRadioButtonMenuItemIcon(),
 999:       "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
1000:       "RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(),
1001:       "RadioButtonMenuItem.foreground", getMenuForeground(),
1002:       "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
1003:       "RadioButtonMenuItem.selectionBackground", 
1004:         MetalLookAndFeel.getMenuSelectedBackground(),
1005:       "RadioButtonMenuItem.selectionForeground", 
1006:         MetalLookAndFeel.getMenuSelectedForeground(),
1007: 
1008:       "ScrollBar.background", getControl(),
1009:       "ScrollBar.darkShadow", getControlDarkShadow(),
1010:       "ScrollBar.foreground", getControl(),
1011:       "ScrollBar.highlight", getControlHighlight(),
1012:       "ScrollBar.shadow", getControlShadow(),
1013:       "ScrollBar.thumb", getPrimaryControlShadow(),
1014:       "ScrollBar.thumbDarkShadow", getControlDarkShadow(),
1015:       "ScrollBar.thumbHighlight", getPrimaryControl(),
1016:       "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
1017:       "ScrollBar.track", getControl(),
1018:       "ScrollBar.trackHighlight", getControlDarkShadow(),
1019:       "ScrollBar.width", new Integer(17),
1020: 
1021:       "ScrollPane.background", getControl(),
1022:       "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
1023:       "ScrollPane.foreground", getControlTextColor(),
1024: 
1025:       "Separator.background", getSeparatorBackground(),
1026:       "Separator.foreground", getSeparatorForeground(),
1027:       "Separator.highlight", getControlHighlight(),
1028:       "Separator.shadow", getControlShadow(),
1029: 
1030:       "Slider.background", getControl(),
1031:       "Slider.focus", getFocusColor(),
1032:       "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
1033:       "Slider.foreground", getPrimaryControlShadow(),
1034:       "Slider.highlight", getControlHighlight(),
1035:       "Slider.horizontalThumbIcon", 
1036:       MetalIconFactory.getHorizontalSliderThumbIcon(),
1037:       "Slider.majorTickLength", new Integer(6),
1038:       "Slider.shadow", getControlShadow(),
1039:       "Slider.trackWidth", new Integer(7),
1040:       "Slider.verticalThumbIcon", 
1041:       MetalIconFactory.getVerticalSliderThumbIcon(),
1042: 
1043:       "Spinner.background", getControl(),
1044:       "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12),
1045:       "Spinner.foreground", getControl(),
1046: 
1047:       "SplitPane.background", getControl(),
1048:       "SplitPane.darkShadow", getControlDarkShadow(),
1049:       "SplitPane.dividerFocusColor", getPrimaryControl(),
1050:       "SplitPane.highlight", getControlHighlight(),
1051:       "SplitPane.shadow", getControlShadow(),
1052: 
1053:       "SplitPaneDivider.draggingColor", Color.DARK_GRAY,
1054: 
1055:       "TabbedPane.background", getControlShadow(),
1056:       "TabbedPane.darkShadow", getControlDarkShadow(),
1057:       "TabbedPane.focus", getPrimaryControlDarkShadow(),
1058:       "TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
1059:       "TabbedPane.foreground", getControlTextColor(),
1060:       "TabbedPane.highlight", getControlHighlight(),
1061:       "TabbedPane.light", getControl(),
1062:       "TabbedPane.selected", getControl(),
1063:       "TabbedPane.selectHighlight", getControlHighlight(),
1064:       "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
1065:       "TabbedPane.shadow", getControlShadow(),
1066:       "TabbedPane.tabAreaBackground", getControl(),
1067:       "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
1068:       "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
1069:       
1070:       "Table.background", getWindowBackground(),
1071:       "Table.focusCellBackground", getWindowBackground(),
1072:       "Table.focusCellForeground", getControlTextColor(),
1073:       "Table.foreground", getControlTextColor(),
1074:       "Table.focusCellHighlightBorder",
1075:       new BorderUIResource.LineBorderUIResource(getControlShadow()),
1076:       "Table.focusCellBackground", getWindowBackground(),
1077:       "Table.gridColor", getControlDarkShadow(),
1078:       "Table.selectionBackground", new ColorUIResource(204, 204, 255),
1079:       "Table.selectionForeground", new ColorUIResource(0, 0, 0),
1080: 
1081:       "TableHeader.background", getControl(),
1082:       "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(),
1083:       "TableHeader.foreground", getControlTextColor(),
1084: 
1085:       "TextArea.background", getWindowBackground(),
1086:       "TextArea.caretForeground", getUserTextColor(),
1087:       "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1088:       "TextArea.foreground", getUserTextColor(),
1089:       "TextArea.inactiveForeground", getInactiveSystemTextColor(),
1090:       "TextArea.selectionBackground", getTextHighlightColor(),
1091:       "TextArea.selectionForeground", getHighlightedTextColor(),
1092: 
1093:       "TextField.background", getWindowBackground(),
1094:       "TextField.border",
1095:       new BorderUIResource(MetalBorders.getTextFieldBorder()),
1096:       "TextField.caretForeground", getUserTextColor(),
1097:       "TextField.darkShadow", getControlDarkShadow(),
1098:       "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1099:       "TextField.foreground", getUserTextColor(),
1100:       "TextField.highlight", getControlHighlight(),
1101:       "TextField.inactiveBackground", getControl(),
1102:       "TextField.inactiveForeground", getInactiveSystemTextColor(),
1103:       "TextField.light", getControlHighlight(),
1104:       "TextField.selectionBackground", getTextHighlightColor(),
1105:       "TextField.selectionForeground", getHighlightedTextColor(),
1106:       "TextField.shadow", getControlShadow(),
1107:      
1108:       "TextPane.background", getWindowBackground(),
1109:       "TextPane.caretForeground", getUserTextColor(),
1110:       "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1111:       "TextPane.foreground", getUserTextColor(),
1112:       "TextPane.inactiveForeground", getInactiveSystemTextColor(),
1113:       "TextPane.selectionBackground", getTextHighlightColor(),
1114:       "TextPane.selectionForeground", getHighlightedTextColor(),
1115: 
1116:       "TitledBorder.font", new FontUIResource("Dialog", Font.BOLD, 12),
1117:       "TitledBorder.titleColor", getSystemTextColor(),
1118: 
1119:       "ToggleButton.background", getControl(),
1120:       "ToggleButton.border", MetalBorders.getToggleButtonBorder(),
1121:       "ToggleButton.darkShadow", getControlDarkShadow(),
1122:       "ToggleButton.disabledText", getInactiveControlTextColor(),
1123:       "ToggleButton.focus", getFocusColor(),
1124:       "ToggleButton.font", getControlTextFont(),
1125:       "ToggleButton.foreground", getControlTextColor(),
1126:       "ToggleButton.highlight", getControlHighlight(),
1127:       "ToggleButton.light", getControlHighlight(),
1128:       "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
1129:       "ToggleButton.select", getControlShadow(),
1130:       "ToggleButton.shadow", getControlShadow(),
1131: 
1132:       "ToolBar.background", getMenuBackground(),
1133:       "ToolBar.darkShadow", getControlDarkShadow(),
1134:       "ToolBar.dockingBackground", getMenuBackground(),
1135:       "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
1136:       "ToolBar.floatingBackground", getMenuBackground(),
1137:       "ToolBar.floatingForeground", getPrimaryControl(),
1138:       "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
1139:       "ToolBar.foreground", getMenuForeground(),
1140:       "ToolBar.highlight", getControlHighlight(),
1141:       "ToolBar.light", getControlHighlight(),
1142:       "ToolBar.shadow", getControlShadow(),
1143:       "ToolBar.border", new MetalBorders.ToolBarBorder(),
1144: 
1145:       "ToolTip.background", getPrimaryControl(),
1146:       "ToolTip.backgroundInactive", getControl(),
1147:       "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1),
1148:       "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
1149:       "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1150:       "ToolTip.foreground", getPrimaryControlInfo(),
1151:       "ToolTip.foregroundInactive", getControlDarkShadow(),
1152: 
1153:       "Tree.background", getWindowBackground(),
1154:       "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
1155:       "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true),
1156:       "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false),
1157:       "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1158:       "Tree.foreground", getUserTextColor(),
1159:       "Tree.hash", getPrimaryControl(),
1160:       "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
1161:       "Tree.leftChildIndent", new Integer(7),
1162:       "Tree.line", getPrimaryControl(),
1163:       "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
1164:       "Tree.rightChildIndent", new Integer(13),
1165:       "Tree.rowHeight", new Integer(20),
1166:       "Tree.scrollsOnExpand", Boolean.TRUE,
1167:       "Tree.selectionBackground", getTextHighlightColor(),
1168:       "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
1169:       "Tree.selectionBorderColor", getFocusColor(),
1170:       "Tree.selectionForeground", getHighlightedTextColor(),
1171:       "Tree.textBackground", getWindowBackground(),
1172:       "Tree.textForeground", getUserTextColor(),
1173: 
1174:       "Viewport.background", getControl(),
1175:       "Viewport.foreground", getUserTextColor()
1176:     };
1177:     defaults.putDefaults(myDefaults);
1178:   }
1179: 
1180:   /**
1181:    * Initializes the system color defaults.
1182:    *
1183:    * In particular this sets the following keys:
1184:    *
1185:    * <table>
1186:    * <tr>
1187:    * <th>Key</th><th>Value</th><th>Description</th>
1188:    * </tr><tr>
1189:    * <td>control</td><td>0xcccccc</td><td>The default color for components</td>
1190:    * </tr>
1191:    * </table>
1192:    */
1193:   protected void initSystemColorDefaults(UIDefaults defaults)
1194:   {
1195:     super.initSystemColorDefaults(defaults);
1196:     Object[] uiDefaults;
1197:     uiDefaults = new Object[] {
1198:       "control", new ColorUIResource(getControl()),
1199:       "desktop", new ColorUIResource(getDesktopColor())
1200:     };
1201:     defaults.putDefaults(uiDefaults);
1202:   }
1203: 
1204: }