GNU Classpath (0.17) | ||
Frames | No Frames |
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.ImageIcon; 46: import javax.swing.UIDefaults; 47: import javax.swing.plaf.ColorUIResource; 48: import javax.swing.plaf.FontUIResource; 49: import javax.swing.plaf.IconUIResource; 50: import javax.swing.plaf.basic.BasicLookAndFeel; 51: 52: /** 53: * A custom look and feel that is designed to look similar across different 54: * operating systems. 55: */ 56: public class MetalLookAndFeel extends BasicLookAndFeel 57: { 58: private static final long serialVersionUID = 6680646159193457980L; 59: 60: /** The current theme. */ 61: private static MetalTheme theme; 62: 63: /** The look and feel defaults. */ 64: private UIDefaults LAF_defaults; 65: 66: /** 67: * Creates a new instance of the Metal look and feel. 68: */ 69: public MetalLookAndFeel() 70: { 71: createDefaultTheme(); 72: } 73: 74: /** 75: * Sets the current theme to a new instance of {@link DefaultMetalTheme}. 76: */ 77: protected void createDefaultTheme() 78: { 79: setCurrentTheme(new DefaultMetalTheme()); 80: } 81: 82: /** 83: * Returns <code>false</code> to indicate that this look and feel does not 84: * attempt to emulate the look and feel of native applications on the host 85: * platform. 86: * 87: * @return <code>false</code>. 88: */ 89: public boolean isNativeLookAndFeel() 90: { 91: return false; 92: } 93: 94: /** 95: * Returns <code>true</code> to indicate that this look and feel is supported 96: * on all platforms. 97: * 98: * @return <code>true</code>. 99: */ 100: public boolean isSupportedLookAndFeel() 101: { 102: return true; 103: } 104: 105: /** 106: * Returns a string describing the look and feel. In this case, the method 107: * returns "Metal look and feel". 108: * 109: * @return A string describing the look and feel. 110: */ 111: public String getDescription() 112: { 113: return "Metal look and feel"; 114: } 115: 116: /** 117: * Returns the look and feel identifier. 118: * 119: * @return "MetalLookAndFeel". 120: */ 121: public String getID() 122: { 123: return "MetalLookAndFeel"; 124: } 125: 126: /** 127: * Returns the look and feel name. 128: * 129: * @return "MetalLookAndFeel". 130: */ 131: public String getName() 132: { 133: return "MetalLookAndFeel"; 134: } 135: 136: public UIDefaults getDefaults() 137: { 138: if (LAF_defaults == null) 139: { 140: LAF_defaults = super.getDefaults(); 141: 142: // add custom theme entries to the table 143: theme.addCustomEntriesToTable(LAF_defaults); 144: } 145: 146: // Returns the default values for this look and feel. 147: return LAF_defaults; 148: } 149: 150: /** 151: * Returns the accelerator foreground color from the installed theme. 152: * 153: * @return The accelerator foreground color. 154: */ 155: public static ColorUIResource getAcceleratorForeground() 156: { 157: return theme.getAcceleratorForeground(); 158: } 159: 160: /** 161: * Returns the accelerator selected foreground color from the installed 162: * theme. 163: * 164: * @return The accelerator selected foreground color. 165: */ 166: public static ColorUIResource getAcceleratorSelectedForeground() 167: { 168: return theme.getAcceleratorSelectedForeground(); 169: } 170: 171: /** 172: * Returns the color black from the installed theme. 173: * 174: * @return The color black. 175: */ 176: public static ColorUIResource getBlack() 177: { 178: return theme.getBlack(); 179: } 180: 181: /** 182: * Returns the control color from the installed theme. 183: * 184: * @return The control color. 185: */ 186: public static ColorUIResource getControl() 187: { 188: return theme.getControl(); 189: } 190: 191: /** 192: * Returns the color used for dark shadows on controls, from the installed 193: * theme. 194: * 195: * @return The color used for dark shadows on controls. 196: */ 197: public static ColorUIResource getControlDarkShadow() 198: { 199: return theme.getControlDarkShadow(); 200: } 201: 202: /** 203: * Returns the color used for disabled controls, from the installed theme. 204: * 205: * @return The color used for disabled controls. 206: */ 207: public static ColorUIResource getControlDisabled() 208: { 209: return theme.getControlDisabled(); 210: } 211: 212: /** 213: * Returns the color used to draw highlights for controls, from the installed 214: * theme. 215: * 216: * @return The color used to draw highlights for controls. 217: */ 218: public static ColorUIResource getControlHighlight() 219: { 220: return theme.getControlHighlight(); 221: } 222: 223: /** 224: * Returns the color used to display control info, from the installed 225: * theme. 226: * 227: * @return The color used to display control info. 228: */ 229: public static ColorUIResource getControlInfo() 230: { 231: return theme.getControlInfo(); 232: } 233: 234: /** 235: * Returns the color used to draw shadows for controls, from the installed 236: * theme. 237: * 238: * @return The color used to draw shadows for controls. 239: */ 240: public static ColorUIResource getControlShadow() 241: { 242: return theme.getControlShadow(); 243: } 244: 245: /** 246: * Returns the color used for text on controls, from the installed theme. 247: * 248: * @return The color used for text on controls. 249: */ 250: public static ColorUIResource getControlTextColor() 251: { 252: return theme.getControlTextColor(); 253: } 254: 255: /** 256: * Returns the font used for text on controls, from the installed theme. 257: * 258: * @return The font used for text on controls. 259: */ 260: public static FontUIResource getControlTextFont() 261: { 262: return theme.getControlTextFont(); 263: } 264: 265: /** 266: * Returns the color used for the desktop background, from the installed 267: * theme. 268: * 269: * @return The color used for the desktop background. 270: */ 271: public static ColorUIResource getDesktopColor() 272: { 273: return theme.getDesktopColor(); 274: } 275: 276: /** 277: * Returns the color used to draw focus highlights, from the installed 278: * theme. 279: * 280: * @return The color used to draw focus highlights. 281: */ 282: public static ColorUIResource getFocusColor() 283: { 284: return theme.getFocusColor(); 285: } 286: 287: /** 288: * Returns the color used to draw highlighted text, from the installed 289: * theme. 290: * 291: * @return The color used to draw highlighted text. 292: */ 293: public static ColorUIResource getHighlightedTextColor() 294: { 295: return theme.getHighlightedTextColor(); 296: } 297: 298: /** 299: * Returns the color used to draw text on inactive controls, from the 300: * installed theme. 301: * 302: * @return The color used to draw text on inactive controls. 303: */ 304: public static ColorUIResource getInactiveControlTextColor() 305: { 306: return theme.getInactiveControlTextColor(); 307: } 308: 309: /** 310: * Returns the color used to draw inactive system text, from the installed 311: * theme. 312: * 313: * @return The color used to draw inactive system text. 314: */ 315: public static ColorUIResource getInactiveSystemTextColor() 316: { 317: return theme.getInactiveSystemTextColor(); 318: } 319: 320: /** 321: * Returns the background color for menu items, from the installed theme. 322: * 323: * @return The background color for menu items. 324: * 325: * @see #getMenuSelectedBackground() 326: */ 327: public static ColorUIResource getMenuBackground() 328: { 329: return theme.getMenuBackground(); 330: } 331: 332: /** 333: * Returns the foreground color for disabled menu items, from the installed 334: * theme. 335: * 336: * @return The foreground color for disabled menu items. 337: * 338: * @see #getMenuForeground() 339: */ 340: public static ColorUIResource getMenuDisabledForeground() 341: { 342: return theme.getMenuDisabledForeground(); 343: } 344: 345: /** 346: * Returns the foreground color for menu items, from the installed theme. 347: * 348: * @return The foreground color for menu items. 349: * 350: * @see #getMenuDisabledForeground() 351: * @see #getMenuSelectedForeground() 352: */ 353: public static ColorUIResource getMenuForeground() 354: { 355: return theme.getMenuForeground(); 356: } 357: 358: /** 359: * Returns the background color for selected menu items, from the installed 360: * theme. 361: * 362: * @return The background color for selected menu items. 363: * 364: * @see #getMenuBackground() 365: */ 366: public static ColorUIResource getMenuSelectedBackground() 367: { 368: return theme.getMenuSelectedBackground(); 369: } 370: 371: /** 372: * Returns the foreground color for selected menu items, from the installed 373: * theme. 374: * 375: * @return The foreground color for selected menu items. 376: * 377: * @see #getMenuForeground() 378: */ 379: public static ColorUIResource getMenuSelectedForeground() 380: { 381: return theme.getMenuSelectedForeground(); 382: } 383: 384: /** 385: * Returns the font used for text in menus, from the installed theme. 386: * 387: * @return The font used for text in menus. 388: */ 389: public static FontUIResource getMenuTextFont() 390: { 391: return theme.getMenuTextFont(); 392: } 393: 394: /** 395: * Returns the primary color for controls, from the installed theme. 396: * 397: * @return The primary color for controls. 398: */ 399: public static ColorUIResource getPrimaryControl() 400: { 401: return theme.getPrimaryControl(); 402: } 403: 404: /** 405: * Returns the primary color for the dark shadow on controls, from the 406: * installed theme. 407: * 408: * @return The primary color for the dark shadow on controls. 409: */ 410: public static ColorUIResource getPrimaryControlDarkShadow() 411: { 412: return theme.getPrimaryControlDarkShadow(); 413: } 414: 415: /** 416: * Returns the primary color for the highlight on controls, from the 417: * installed theme. 418: * 419: * @return The primary color for the highlight on controls. 420: */ 421: public static ColorUIResource getPrimaryControlHighlight() 422: { 423: return theme.getPrimaryControlHighlight(); 424: } 425: 426: /** 427: * Returns the primary color for the information on controls, from the 428: * installed theme. 429: * 430: * @return The primary color for the information on controls. 431: */ 432: public static ColorUIResource getPrimaryControlInfo() 433: { 434: return theme.getPrimaryControlInfo(); 435: } 436: 437: /** 438: * Returns the primary color for the shadow on controls, from the installed 439: * theme. 440: * 441: * @return The primary color for the shadow on controls. 442: */ 443: public static ColorUIResource getPrimaryControlShadow() 444: { 445: return theme.getPrimaryControlShadow(); 446: } 447: 448: /** 449: * Returns the background color for separators, from the installed theme. 450: * 451: * @return The background color for separators. 452: */ 453: public static ColorUIResource getSeparatorBackground() 454: { 455: return theme.getSeparatorBackground(); 456: } 457: 458: /** 459: * Returns the foreground color for separators, from the installed theme. 460: * 461: * @return The foreground color for separators. 462: */ 463: public static ColorUIResource getSeparatorForeground() 464: { 465: return theme.getSeparatorForeground(); 466: } 467: 468: /** 469: * Returns the font used for sub text, from the installed theme. 470: * 471: * @return The font used for sub text. 472: */ 473: public static FontUIResource getSubTextFont() 474: { 475: return theme.getSubTextFont(); 476: } 477: 478: /** 479: * Returns the color used for system text, from the installed theme. 480: * 481: * @return The color used for system text. 482: */ 483: public static ColorUIResource getSystemTextColor() 484: { 485: return theme.getSystemTextColor(); 486: } 487: 488: /** 489: * Returns the font used for system text, from the installed theme. 490: * 491: * @return The font used for system text. 492: */ 493: public static FontUIResource getSystemTextFont() 494: { 495: return theme.getSystemTextFont(); 496: } 497: 498: /** 499: * Returns the color used to highlight text, from the installed theme. 500: * 501: * @return The color used to highlight text. 502: */ 503: public static ColorUIResource getTextHighlightColor() 504: { 505: return theme.getTextHighlightColor(); 506: } 507: 508: /** 509: * Returns the color used to display user text, from the installed theme. 510: * 511: * @return The color used to display user text. 512: */ 513: public static ColorUIResource getUserTextColor() 514: { 515: return theme.getUserTextColor(); 516: } 517: 518: /** 519: * Returns the font used for user text, obtained from the current theme. 520: * 521: * @return The font used for user text. 522: */ 523: public static FontUIResource getUserTextFont() 524: { 525: return theme.getUserTextFont(); 526: } 527: 528: /** 529: * Returns the color used for white, from the installed theme. 530: * 531: * @return The color used for white. 532: */ 533: public static ColorUIResource getWhite() 534: { 535: return theme.getWhite(); 536: } 537: 538: /** 539: * Returns the window background color, from the installed theme. 540: * 541: * @return The window background color. 542: */ 543: public static ColorUIResource getWindowBackground() 544: { 545: return theme.getWindowBackground(); 546: } 547: 548: /** 549: * Returns the window title background color, from the installed theme. 550: * 551: * @return The window title background color. 552: */ 553: public static ColorUIResource getWindowTitleBackground() 554: { 555: return theme.getWindowTitleBackground(); 556: } 557: 558: /** 559: * Returns the window title font from the current theme. 560: * 561: * @return The window title font. 562: * 563: * @see MetalTheme 564: */ 565: public static FontUIResource getWindowTitleFont() 566: { 567: return theme.getWindowTitleFont(); 568: } 569: 570: /** 571: * Returns the window title foreground color, from the installed theme. 572: * 573: * @return The window title foreground color. 574: */ 575: public static ColorUIResource getWindowTitleForeground() 576: { 577: return theme.getWindowTitleForeground(); 578: } 579: 580: /** 581: * Returns the background color for an inactive window title, from the 582: * installed theme. 583: * 584: * @return The background color for an inactive window title. 585: */ 586: public static ColorUIResource getWindowTitleInactiveBackground() 587: { 588: return theme.getWindowTitleInactiveBackground(); 589: } 590: 591: /** 592: * Returns the foreground color for an inactive window title, from the 593: * installed theme. 594: * 595: * @return The foreground color for an inactive window title. 596: */ 597: public static ColorUIResource getWindowTitleInactiveForeground() 598: { 599: return theme.getWindowTitleInactiveForeground(); 600: } 601: 602: /** 603: * Sets the current theme for the look and feel. 604: * 605: * @param theme the theme. 606: */ 607: public static void setCurrentTheme(MetalTheme theme) 608: { 609: MetalLookAndFeel.theme = theme; 610: } 611: 612: /** 613: * Sets the ComponentUI classes for all Swing components to the Metal 614: * implementations. 615: * 616: * In particular this sets the following keys: 617: * 618: * <table> 619: * <tr> 620: * <th>Key</th><th>Value</th> 621: * </tr><tr> 622: * <td>ButtonUI</td><td>{@link MetalButtonUI}</td> 623: * </tr><tr> 624: * <td>CheckBoxUI</td><td>{@link MetalCheckBoxUI}</td> 625: * </tr><tr> 626: * <td>ComboBoxUI</td><td>{@link MetalComboBoxUI}</td> 627: * </tr><tr> 628: * <td>DesktopIconUI</td><td>{@link MetalDesktopIconUI}</td> 629: * </tr><tr> 630: * <td>InternalFrameUI</td><td>{@link MetalInternalFrameUI}</td> 631: * </tr><tr> 632: * <td>LabelUI</td><td>{@link MetalLabelUI}</td> 633: * </tr><tr> 634: * <td>PopupMenuSeparatorUI</td><td>{@link MetalPopupMenuSeparatorUI}</td> 635: * </tr><tr> 636: * <td>ProgressBarUI</td><td>{@link MetalProgressBarUI}</td> 637: * </tr><tr> 638: * <td>RadioButtonUI</td><td>{@link MetalRadioButtonUI}</td> 639: * </tr><tr> 640: * <td>RootPaneUI</td><td>{@link MetalRootPaneUI}</td> 641: * </tr><tr> 642: * <td>ScrollBarUI</td><td>{@link MetalScrollBarUI}</td> 643: * </tr><tr> 644: * <td>ScrollPaneUI</td><td>{@link MetalScrollPaneUI}</td> 645: * </tr><tr> 646: * <td>SeparatorUI</td><td>{@link MetalSeparatorUI}</td> 647: * </tr><tr> 648: * <td>SliderUI</td><td>{@link MetalSliderUI}</td> 649: * </tr><tr> 650: * <td>SplitPaneUI</td><td>{@link MetalSplitPaneUI}</td> 651: * </tr><tr> 652: * <td>TabbedPaneUI</td><td>{@link MetalTabbedPaneUI}</td> 653: * </tr><tr> 654: * <td>TextFieldUI</td><td>{@link MetalTextFieldUI}</td> 655: * </tr><tr> 656: * <td>ToggleButtonUI</td><td>{@link MetalToggleButtonUI}</td> 657: * </tr><tr> 658: * <td>ToolBarUI</td><td>{@link MetalToolBarUI}</td> 659: * </tr><tr> 660: * <td>ToolTipUI</td><td>{@link MetalToolTipUI}</td> 661: * </tr><tr> 662: * <td>TreeUI</td><td>{@link MetalTreeUI}</td> 663: * </tr><tr> 664: * </table> 665: * 666: * @param defaults the UIDefaults where the class defaults are added 667: */ 668: protected void initClassDefaults(UIDefaults defaults) 669: { 670: super.initClassDefaults(defaults); 671: 672: // Variables 673: Object[] uiDefaults; 674: // Initialize Class Defaults 675: uiDefaults = new Object[] { 676: "ButtonUI", "javax.swing.plaf.metal.MetalButtonUI", 677: "CheckBoxUI", "javax.swing.plaf.metal.MetalCheckBoxUI", 678: "ComboBoxUI", "javax.swing.plaf.metal.MetalComboBoxUI", 679: "DesktopIconUI", "javax.swing.plaf.metal.MetalDesktopIconUI", 680: "InternalFrameUI", "javax.swing.plaf.metal.MetalInternalFrameUI", 681: "LabelUI", "javax.swing.plaf.metal.MetalLabelUI", 682: "PopupMenuSeparatorUI", 683: "javax.swing.plaf.metal.MetalPopupMenuSeparatorUI", 684: "ProgressBarUI", "javax.swing.plaf.metal.MetalProgressBarUI", 685: "RadioButtonUI", "javax.swing.plaf.metal.MetalRadioButtonUI", 686: "RootPaneUI", "javax.swing.plaf.metal.MetalRootPaneUI", 687: "ScrollBarUI", "javax.swing.plaf.metal.MetalScrollBarUI", 688: "ScrollPaneUI", "javax.swing.plaf.metal.MetalScrollPaneUI", 689: "SeparatorUI", "javax.swing.plaf.metal.MetalSeparatorUI", 690: "SliderUI", "javax.swing.plaf.metal.MetalSliderUI", 691: "SplitPaneUI", "javax.swing.plaf.metal.MetalSplitPaneUI", 692: "TabbedPaneUI", "javax.swing.plaf.metal.MetalTabbedPaneUI", 693: "TextFieldUI", "javax.swing.plaf.metal.MetalTextFieldUI", 694: "ToggleButtonUI", "javax.swing.plaf.metal.MetalToggleButtonUI", 695: "ToolBarUI", "javax.swing.plaf.metal.MetalToolBarUI", 696: "ToolTipUI", "javax.swing.plaf.metal.MetalToolTipUI", 697: "TreeUI", "javax.swing.plaf.metal.MetalTreeUI", 698: }; 699: // Add Class Defaults to UI Defaults table 700: defaults.putDefaults(uiDefaults); 701: } 702: 703: /** 704: * Initializes the component defaults for the Metal Look & Feel. 705: * 706: * In particular this sets the following keys (the colors are given 707: * as RGB hex values): 708: * 709: * <table> 710: * <tr> 711: * <th>Key</th><th>Value</th> 712: * </tr><tr> 713: * <td>Button.background</td><td>0xcccccc</td> 714: * </tr><tr> 715: * <td>Button.border</td><td>{@link MetalBorders#getButtonBorder()}</td> 716: * </tr><tr> 717: * <td>Button.font</td><td>{@link #getControlTextFont}</td> 718: * </tr><tr> 719: * <td>Button.margin</td><td><code>new java.awt.Insets(2, 14, 2, 14)</code> 720: * </td> 721: * </tr><tr> 722: * <td>CheckBox.background</td><td>0xcccccc</td> 723: * </tr><tr> 724: * <td>CheckBoxMenuItem.background</td><td>0xcccccc</td> 725: * </tr><tr> 726: * <td>ToolBar.background</td><td>0xcccccc</td> 727: * </tr><tr> 728: * <td>Panel.background</td><td>0xcccccc</td> 729: * </tr><tr> 730: * <td>Slider.background</td><td>0xcccccc</td> 731: * </tr><tr> 732: * <td>OptionPane.background</td><td>0xcccccc</td> 733: * </tr><tr> 734: * <td>ProgressBar.background</td><td>0xcccccc</td> 735: * </tr><tr> 736: * <td>TabbedPane.background</td><td>0xcccccc</td> 737: * </tr><tr> 738: * <td>Label.background</td><td>0xcccccc</td> 739: * </tr><tr> 740: * <td>Label.font</td><td>{@link #getControlTextFont}</td> 741: * </tr><tr> 742: * <td>Menu.background</td><td>0xcccccc</td> 743: * </tr><tr> 744: * <td>MenuBar.background</td><td>0xcccccc</td> 745: * </tr><tr> 746: * <td>MenuItem.background</td><td>0xcccccc</td> 747: * </tr><tr> 748: * <td>ScrollBar.background</td><td>0xcccccc</td> 749: * </tr><tr> 750: * <td>PopupMenu.border</td> 751: * <td><code>new javax.swing.plaf.metal.MetalBorders.PopupMenuBorder()</td> 752: * </tr><tr> 753: * </table> 754: * 755: * @param defaults the UIDefaults instance to which the values are added 756: */ 757: protected void initComponentDefaults(UIDefaults defaults) 758: { 759: super.initComponentDefaults(defaults); 760: Object[] myDefaults = new Object[] { 761: "Button.background", new ColorUIResource(getControl()), 762: "Button.border", MetalBorders.getButtonBorder(), 763: "Button.darkShadow", new ColorUIResource(getControlDarkShadow()), 764: "Button.disabledText", new ColorUIResource(getControlDisabled()), 765: "Button.focus", new ColorUIResource(getFocusColor()), 766: "Button.font", getControlTextFont(), 767: "Button.foreground", new ColorUIResource(getSystemTextColor()), 768: "Button.highlight", new ColorUIResource(getControlHighlight()), 769: "Button.light", new ColorUIResource(getControlHighlight()), 770: "Button.margin", new Insets(2, 14, 2, 14), 771: "Button.select", new ColorUIResource(getPrimaryControlShadow()), 772: "Button.shadow", new ColorUIResource(getPrimaryControlShadow()), 773: "CheckBox.background", new ColorUIResource(getControl()), 774: "CheckBoxMenuItem.background", new ColorUIResource(getControl()), 775: "ToolBar.background", new ColorUIResource(getControl()), 776: "Panel.background", new ColorUIResource(getControl()), 777: "Slider.background", new ColorUIResource(getControl()), 778: "OptionPane.background", new ColorUIResource(getControl()), 779: "ProgressBar.background", new ColorUIResource(getControl()), 780: "ScrollPane.border", new MetalBorders.ScrollPaneBorder(), 781: "TabbedPane.background", new ColorUIResource(getControl()), 782: "Label.background", new ColorUIResource(getControl()), 783: "Label.font", getControlTextFont(), 784: "Label.disabledForeground", new ColorUIResource(getControlDisabled()), 785: "Label.foreground", new ColorUIResource(getSystemTextColor()), 786: "Menu.background", new ColorUIResource(getControl()), 787: "Menu.font", getControlTextFont(), 788: "MenuBar.background", new ColorUIResource(getControl()), 789: "MenuBar.font", getControlTextFont(), 790: "MenuItem.background", new ColorUIResource(getControl()), 791: "MenuItem.font", getControlTextFont(), 792: "ScrollBar.background", new ColorUIResource(getControl()), 793: "ScrollBar.shadow", new ColorUIResource(getControlShadow()), 794: "ScrollBar.thumb", new ColorUIResource(getPrimaryControlShadow()), 795: "ScrollBar.thumbDarkShadow", 796: new ColorUIResource(getPrimaryControlDarkShadow()), 797: "ScrollBar.thumbHighlight", 798: new ColorUIResource(getPrimaryControl()), 799: 800: "SplitPane.darkShadow", 801: new ColorUIResource(getControlDarkShadow()), 802: "SplitPane.highlight", 803: new ColorUIResource(getControlHighlight()), 804: 805: "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(), 806: "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(), 807: "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(), 808: "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true), 809: "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false), 810: "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), 811: "Tree.background", new ColorUIResource(Color.white), 812: "Tree.foreground", new ColorUIResource(new Color(204, 204, 255)), 813: "Tree.hash", new ColorUIResource(new Color(204, 204, 255)), 814: "Tree.leftChildIndent", new Integer(7), 815: "Tree.rightChildIndent", new Integer(13), 816: "Tree.rowHeight", new Integer(20), 817: "Tree.scrollsOnExpand", Boolean.TRUE, 818: "Tree.selectionBackground", new ColorUIResource(new Color(204, 204, 255)), 819: "Tree.nonSelectionBackground", new ColorUIResource(Color.white), 820: "Tree.selectionBorderColor", new ColorUIResource(new Color(102, 102, 153)), 821: "Tree.selectionForeground", new ColorUIResource(Color.black), 822: "Tree.textBackground", new ColorUIResource(new Color(204, 204, 255)), 823: "Tree.textForeground", new ColorUIResource(Color.black), 824: "Tree.selectionForeground", new ColorUIResource(Color.black), 825: "PopupMenu.border", new MetalBorders.PopupMenuBorder() 826: }; 827: defaults.putDefaults(myDefaults); 828: } 829: 830: /** 831: * Initializes the system color defaults. 832: * 833: * In particular this sets the following keys: 834: * 835: * <table> 836: * <tr> 837: * <th>Key</th><th>Value</th><th>Description</th> 838: * </tr><tr> 839: * <td>control</td><td>0xcccccc</td><td>The default color for components</td> 840: * </tr> 841: * </table> 842: */ 843: protected void initSystemColorDefaults(UIDefaults defaults) 844: { 845: super.initSystemColorDefaults(defaults); 846: Object[] uiDefaults; 847: uiDefaults = new Object[] { 848: "control", new ColorUIResource(getControl()) 849: }; 850: defaults.putDefaults(uiDefaults); 851: } 852: 853: }
GNU Classpath (0.17) |