1. /*
  2. * @(#)DefaultMetalTheme.java 1.16 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.metal;
  8. import javax.swing.plaf.*;
  9. import javax.swing.*;
  10. import java.awt.*;
  11. /**
  12. * This class describes the default Metal Theme.
  13. * <p>
  14. * <strong>Warning:</strong>
  15. * Serialized objects of this class will not be compatible with
  16. * future Swing releases. The current serialization support is appropriate
  17. * for short term storage or RMI between applications running the same
  18. * version of Swing. A future release of Swing will provide support for
  19. * long term persistence.
  20. *
  21. * @version 1.16 11/29/01
  22. * @author Steve Wilson
  23. */
  24. public class DefaultMetalTheme extends MetalTheme {
  25. private final ColorUIResource primary1 = new ColorUIResource(102, 102, 153);
  26. private final ColorUIResource primary2 = new ColorUIResource(153, 153, 204);
  27. private final ColorUIResource primary3 = new ColorUIResource(204, 204, 255);
  28. private final ColorUIResource secondary1 = new ColorUIResource(102, 102, 102);
  29. private final ColorUIResource secondary2 = new ColorUIResource(153, 153, 153);
  30. private final ColorUIResource secondary3 = new ColorUIResource(204, 204, 204);
  31. private FontUIResource controlFont;
  32. private FontUIResource systemFont;
  33. private FontUIResource userFont;
  34. private FontUIResource smallFont;
  35. public String getName() { return "Steel"; }
  36. public DefaultMetalTheme() {
  37. // note the properties listed here can currently be used by people
  38. // providing runtimes to hint what fonts are good. For example the bold
  39. // dialog font looks bad on a Mac, so Apple could use this property to hint at a good font.
  40. // However, we don't promise to support these forever. We may move to getting these
  41. // from the swing.properties file, or elsewhere.
  42. try {
  43. controlFont = new FontUIResource(Font.getFont("swing.plaf.metal.controlFont", new Font("Dialog", Font.BOLD, 12)));
  44. systemFont = new FontUIResource(Font.getFont("swing.plaf.metal.systemFont", new Font("Dialog", Font.PLAIN, 12)));
  45. userFont = new FontUIResource(Font.getFont("swing.plaf.metal.userFont", new Font("Dialog", Font.PLAIN, 12)));
  46. smallFont = new FontUIResource(Font.getFont("swing.plaf.metal.smallFont", new Font("Dialog", Font.PLAIN, 10)));
  47. } catch (Exception e) {
  48. controlFont = new FontUIResource("Dialog", Font.BOLD, 12);
  49. systemFont = new FontUIResource("Dialog", Font.PLAIN, 12);
  50. userFont = new FontUIResource("Dialog", Font.PLAIN, 12);
  51. smallFont = new FontUIResource("Dialog", Font.PLAIN, 10);
  52. }
  53. }
  54. // these are blue in Metal Default Theme
  55. protected ColorUIResource getPrimary1() { return primary1; }
  56. protected ColorUIResource getPrimary2() { return primary2; }
  57. protected ColorUIResource getPrimary3() { return primary3; }
  58. // these are gray in Metal Default Theme
  59. protected ColorUIResource getSecondary1() { return secondary1; }
  60. protected ColorUIResource getSecondary2() { return secondary2; }
  61. protected ColorUIResource getSecondary3() { return secondary3; }
  62. public FontUIResource getControlTextFont() { return controlFont;}
  63. public FontUIResource getSystemTextFont() { return systemFont;}
  64. public FontUIResource getUserTextFont() { return userFont;}
  65. public FontUIResource getMenuTextFont() { return controlFont;}
  66. public FontUIResource getWindowTitleFont() { return controlFont;}
  67. public FontUIResource getSubTextFont() { return smallFont;}
  68. }