1. /*
  2. * @(#)MetalTheme.java 1.14 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. /**
  11. * This interface acts as a generic way to describe the colors
  12. * used by Metal. Classes which implement this interface can
  13. * be used to swap the colors in a Metal application.
  14. *
  15. * @version 1.14 11/29/01
  16. * @author Steve Wilson
  17. */
  18. public abstract class MetalTheme {
  19. private static ColorUIResource white = new ColorUIResource( 255, 255, 255 );
  20. private static ColorUIResource black = new ColorUIResource( 0, 0, 0 );
  21. public abstract String getName();
  22. protected abstract ColorUIResource getPrimary1(); // these are blue in Metal Default Theme
  23. protected abstract ColorUIResource getPrimary2();
  24. protected abstract ColorUIResource getPrimary3();
  25. protected abstract ColorUIResource getSecondary1(); // these are gray in Metal Default Theme
  26. protected abstract ColorUIResource getSecondary2();
  27. protected abstract ColorUIResource getSecondary3();
  28. public abstract FontUIResource getControlTextFont();
  29. public abstract FontUIResource getSystemTextFont();
  30. public abstract FontUIResource getUserTextFont();
  31. public abstract FontUIResource getMenuTextFont();
  32. public abstract FontUIResource getWindowTitleFont();
  33. public abstract FontUIResource getSubTextFont();
  34. protected ColorUIResource getWhite() { return white; }
  35. protected ColorUIResource getBlack() { return black; }
  36. public ColorUIResource getFocusColor() { return getPrimary2(); }
  37. public ColorUIResource getDesktopColor() { return getPrimary2(); }
  38. public ColorUIResource getControl() { return getSecondary3(); }
  39. public ColorUIResource getControlShadow() { return getSecondary2(); }
  40. public ColorUIResource getControlDarkShadow() { return getSecondary1(); }
  41. public ColorUIResource getControlInfo() { return getBlack(); }
  42. public ColorUIResource getControlHighlight() { return getWhite(); }
  43. public ColorUIResource getControlDisabled() { return getSecondary2(); }
  44. public ColorUIResource getPrimaryControl() { return getPrimary3(); }
  45. public ColorUIResource getPrimaryControlShadow() { return getPrimary2(); }
  46. public ColorUIResource getPrimaryControlDarkShadow() { return getPrimary1(); }
  47. public ColorUIResource getPrimaryControlInfo() { return getBlack(); }
  48. public ColorUIResource getPrimaryControlHighlight() { return getWhite(); }
  49. public ColorUIResource getSystemTextColor() { return getPrimary1(); }
  50. public ColorUIResource getControlTextColor() { return getControlInfo(); }
  51. public ColorUIResource getInactiveControlTextColor() { return getControlDisabled(); }
  52. public ColorUIResource getInactiveSystemTextColor() { return getSecondary2(); }
  53. public ColorUIResource getUserTextColor() { return getBlack(); }
  54. public ColorUIResource getTextHighlightColor() { return getPrimary3(); }
  55. public ColorUIResource getHighlightedTextColor() { return getControlTextColor(); }
  56. public ColorUIResource getWindowBackground() { return getWhite(); }
  57. public ColorUIResource getWindowTitleBackground() { return getPrimary3(); }
  58. public ColorUIResource getWindowTitleForeground() { return getBlack(); }
  59. public ColorUIResource getWindowTitleInactiveBackground() { return getSecondary3(); }
  60. public ColorUIResource getWindowTitleInactiveForeground() { return getBlack(); }
  61. public ColorUIResource getMenuBackground() { return getSecondary3(); }
  62. public ColorUIResource getMenuForeground() { return getBlack(); }
  63. public ColorUIResource getMenuSelectedBackground() { return getPrimary2(); }
  64. public ColorUIResource getMenuSelectedForeground() { return getBlack(); }
  65. public ColorUIResource getMenuDisabledForeground() { return getSecondary2(); }
  66. public ColorUIResource getSeparatorBackground() { return getWhite(); }
  67. public ColorUIResource getSeparatorForeground() { return getPrimary1(); }
  68. public ColorUIResource getAcceleratorForeground() { return getPrimary1(); }
  69. public ColorUIResource getAcceleratorSelectedForeground() { return getBlack(); }
  70. public void addCustomEntriesToTable(UIDefaults table) {}
  71. }