1. /*
  2. * @(#)BasicLookAndFeel.java 1.145 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.basic;
  8. import java.awt.Font;
  9. import java.awt.Color;
  10. import java.awt.SystemColor;
  11. import java.awt.event.KeyEvent;
  12. import java.awt.Insets;
  13. import java.net.URL;
  14. import java.io.Serializable;
  15. import java.awt.Dimension;
  16. import java.util.*;
  17. import javax.swing.LookAndFeel;
  18. import javax.swing.BorderFactory;
  19. import javax.swing.JComponent;
  20. import javax.swing.ImageIcon;
  21. import javax.swing.UIDefaults;
  22. import javax.swing.UIManager;
  23. import javax.swing.KeyStroke;
  24. import javax.swing.JTextField;
  25. import javax.swing.DefaultListCellRenderer;
  26. import javax.swing.border.*;
  27. import javax.swing.plaf.*;
  28. import javax.swing.text.JTextComponent;
  29. import javax.swing.text.DefaultEditorKit;
  30. /**
  31. * Implements the a standard base LookAndFeel class from which
  32. * standard desktop LookAndFeel classes (JLF, Mac, Windows, etc.)
  33. * can be derived. This class cannot be instantiated directly,
  34. * however the UI classes "Basic" defines can be.
  35. * <p>
  36. * <strong>Warning:</strong>
  37. * Serialized objects of this class will not be compatible with
  38. * future Swing releases. The current serialization support is appropriate
  39. * for short term storage or RMI between applications running the same
  40. * version of Swing. A future release of Swing will provide support for
  41. * long term persistence.
  42. *
  43. * @version 1.145 11/29/01
  44. * @author unattributed
  45. */
  46. public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable
  47. {
  48. public UIDefaults getDefaults() {
  49. UIDefaults table = new UIDefaults();
  50. initClassDefaults(table);
  51. initSystemColorDefaults(table);
  52. initComponentDefaults(table);
  53. return table;
  54. }
  55. /**
  56. * Initialize the uiClassID to BasicComponentUI mapping.
  57. * The JComponent classes define their own uiClassID constants
  58. * (see AbstractComponent.getUIClassID). This table must
  59. * map those constants to a BasicComponentUI class of the
  60. * appropriate type.
  61. *
  62. * @see #getDefaults
  63. */
  64. protected void initClassDefaults(UIDefaults table)
  65. {
  66. String basicPackageName = "javax.swing.plaf.basic.";
  67. Object[] uiDefaults = {
  68. "ButtonUI", basicPackageName + "BasicButtonUI",
  69. "CheckBoxUI", basicPackageName + "BasicCheckBoxUI",
  70. "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
  71. "MenuBarUI", basicPackageName + "BasicMenuBarUI",
  72. "MenuUI", basicPackageName + "BasicMenuUI",
  73. "MenuItemUI", basicPackageName + "BasicMenuItemUI",
  74. "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI",
  75. "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI",
  76. "RadioButtonUI", basicPackageName + "BasicRadioButtonUI",
  77. "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI",
  78. "PopupMenuUI", basicPackageName + "BasicPopupMenuUI",
  79. "ProgressBarUI", basicPackageName + "BasicProgressBarUI",
  80. "ScrollBarUI", basicPackageName + "BasicScrollBarUI",
  81. "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI",
  82. "SplitPaneUI", basicPackageName + "BasicSplitPaneUI",
  83. "SliderUI", basicPackageName + "BasicSliderUI",
  84. "SeparatorUI", basicPackageName + "BasicSeparatorUI",
  85. "ToolBarSeparatorUI", basicPackageName + "BasicToolBarSeparatorUI",
  86. "PopupMenuSeparatorUI", basicPackageName + "BasicPopupMenuSeparatorUI",
  87. "TabbedPaneUI", basicPackageName + "BasicTabbedPaneUI",
  88. "TextAreaUI", basicPackageName + "BasicTextAreaUI",
  89. "TextFieldUI", basicPackageName + "BasicTextFieldUI",
  90. "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI",
  91. "TextPaneUI", basicPackageName + "BasicTextPaneUI",
  92. "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
  93. "TreeUI", basicPackageName + "BasicTreeUI",
  94. "LabelUI", basicPackageName + "BasicLabelUI",
  95. "ListUI", basicPackageName + "BasicListUI",
  96. "ToolBarUI", basicPackageName + "BasicToolBarUI",
  97. "ToolTipUI", basicPackageName + "BasicToolTipUI",
  98. "ComboBoxUI", basicPackageName + "BasicComboBoxUI",
  99. "TableUI", basicPackageName + "BasicTableUI",
  100. "TableHeaderUI", basicPackageName + "BasicTableHeaderUI",
  101. "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
  102. "StandardDialogUI", basicPackageName + "BasicStandardDialogUI",
  103. "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
  104. "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
  105. "OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
  106. "PanelUI", basicPackageName + "BasicPanelUI",
  107. "ViewportUI", basicPackageName + "BasicViewportUI",
  108. };
  109. table.putDefaults(uiDefaults);
  110. }
  111. /**
  112. * Load the SystemColors into the defaults table. The keys
  113. * for SystemColor defaults are the same as the names of
  114. * the public fields in SystemColor. If the table is being
  115. * created on a native Windows platform we use the SystemColor
  116. * values, otherwise we create color objects whose values match
  117. * the defaults Windows95 colors.
  118. */
  119. protected void initSystemColorDefaults(UIDefaults table)
  120. {
  121. String[] defaultSystemColors = {
  122. "desktop", "#005C5C", /* Color of the desktop background */
  123. "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
  124. "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
  125. "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
  126. "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
  127. "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
  128. "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
  129. "window", "#FFFFFF", /* Default color for the interior of windows */
  130. "windowBorder", "#000000", /* ??? */
  131. "windowText", "#000000", /* ??? */
  132. "menu", "#C0C0C0", /* Background color for menus */
  133. "menuText", "#000000", /* Text color for menus */
  134. "text", "#C0C0C0", /* Text background color */
  135. "textText", "#000000", /* Text foreground color */
  136. "textHighlight", "#000080", /* Text background color when selected */
  137. "textHighlightText", "#FFFFFF", /* Text color when selected */
  138. "textInactiveText", "#808080", /* Text color when disabled */
  139. "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
  140. "controlText", "#000000", /* Default color for text in controls */
  141. "controlHighlight", "#C0C0C0",
  142. /* "controlHighlight", "#E0E0E0",*/ /* Specular highlight (opposite of the shadow) */
  143. "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
  144. "controlShadow", "#808080", /* Shadow color for controls */
  145. "controlDkShadow", "#000000", /* Dark shadow color for controls */
  146. "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
  147. "info", "#FFFFE1", /* ??? */
  148. "infoText", "#000000" /* ??? */
  149. };
  150. loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
  151. }
  152. /**
  153. * If this is the native look and feel the initial values for the
  154. * system color properties are the same as the SystemColor constants.
  155. * If not we use the integer color values in the <code>systemColors</code>
  156. * argument.
  157. */
  158. protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)
  159. {
  160. /* PENDING(hmuller) We don't load the system colors below because
  161. * they're not reliable. Hopefully we'll be able to do better in
  162. * a future version of AWT.
  163. */
  164. if (useNative) {
  165. for(int i = 0; i < systemColors.length; i += 2) {
  166. Color color = Color.black;
  167. try {
  168. String name = systemColors[i];
  169. color = (Color)(SystemColor.class.getField(name).get(null));
  170. } catch (Exception e) {
  171. }
  172. table.put(systemColors[i], new ColorUIResource(color));
  173. }
  174. } else {
  175. for(int i = 0; i < systemColors.length; i += 2) {
  176. Color color = Color.black;
  177. try {
  178. color = Color.decode(systemColors[i + 1]);
  179. }
  180. catch(NumberFormatException e) {
  181. e.printStackTrace();
  182. }
  183. table.put(systemColors[i], new ColorUIResource(color));
  184. }
  185. }
  186. }
  187. private void loadResourceBundle(UIDefaults table) {
  188. ResourceBundle bundle = ResourceBundle.getBundle("javax.swing.plaf.basic.resources.basic");
  189. Enumeration iter = bundle.getKeys();
  190. while(iter.hasMoreElements()) {
  191. String key = (String)iter.nextElement();
  192. //System.out.println("key :" +key+ " value: " + bundle.getObject(key));
  193. table.put( key, bundle.getObject(key) );
  194. }
  195. }
  196. protected void initComponentDefaults(UIDefaults table)
  197. {
  198. loadResourceBundle(table);
  199. // *** Shared Fonts
  200. FontUIResource dialogPlain12 = new FontUIResource("Dialog", Font.PLAIN, 12);
  201. FontUIResource serifPlain12 = new FontUIResource("Serif", Font.PLAIN, 12);
  202. FontUIResource sansSerifPlain12 = new FontUIResource("SansSerif", Font.PLAIN, 12);
  203. FontUIResource monospacedPlain12 = new FontUIResource("Monospaced", Font.PLAIN, 12);
  204. FontUIResource dialogBold12 = new FontUIResource("Dialog", Font.BOLD, 12);
  205. // *** Shared Colors
  206. ColorUIResource red = new ColorUIResource(Color.red);
  207. ColorUIResource black = new ColorUIResource(Color.black);
  208. ColorUIResource white = new ColorUIResource(Color.white);
  209. ColorUIResource yellow = new ColorUIResource(Color.yellow);
  210. ColorUIResource gray = new ColorUIResource(Color.gray);
  211. ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
  212. ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
  213. ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224);
  214. // *** Shared Insets
  215. InsetsUIResource zeroInsets = new InsetsUIResource(0,0,0,0);
  216. // *** Shared Borders
  217. Border zeroBorder = new BorderUIResource.EmptyBorderUIResource(0,0,0,0);
  218. Border marginBorder = new BasicBorders.MarginBorder();
  219. Border etchedBorder = BorderUIResource.getEtchedBorderUIResource();
  220. Border loweredBevelBorder = BorderUIResource.getLoweredBevelBorderUIResource();
  221. Border raisedBevelBorder = BorderUIResource.getRaisedBevelBorderUIResource();
  222. Border blackLineBorder = BorderUIResource.getBlackLineBorderUIResource();
  223. Border focusCellHighlightBorder = new BorderUIResource.LineBorderUIResource(yellow);
  224. // *** Button value objects
  225. Object buttonBorder = new BorderUIResource.CompoundBorderUIResource(
  226. new BasicBorders.ButtonBorder(
  227. table.getColor("controlShadow"),
  228. table.getColor("controlDkShadow"),
  229. table.getColor("controlHighlight"),
  230. table.getColor("controlLtHighlight")),
  231. marginBorder);
  232. Object buttonToggleBorder = new BorderUIResource.CompoundBorderUIResource(
  233. new BasicBorders.ToggleButtonBorder(
  234. table.getColor("controlShadow"),
  235. table.getColor("controlDkShadow"),
  236. table.getColor("controlHighlight"),
  237. table.getColor("controlLtHighlight")),
  238. marginBorder);
  239. Object radioButtonBorder = new BorderUIResource.CompoundBorderUIResource(
  240. new BasicBorders.RadioButtonBorder(
  241. table.getColor("controlShadow"),
  242. table.getColor("controlDkShadow"),
  243. table.getColor("controlHighlight"),
  244. table.getColor("controlLtHighlight")),
  245. marginBorder);
  246. // *** FileChooser / FileView value objects
  247. Object newFolderIcon = LookAndFeel.makeIcon(getClass(), "icons/NewFolder.gif");
  248. Object upFolderIcon = LookAndFeel.makeIcon(getClass(), "icons/UpFolder.gif");
  249. Object homeFolderIcon = LookAndFeel.makeIcon(getClass(), "icons/HomeFolder.gif");
  250. Object detailsViewIcon = LookAndFeel.makeIcon(getClass(), "icons/DetailsView.gif");
  251. Object listViewIcon = LookAndFeel.makeIcon(getClass(), "icons/ListView.gif");
  252. Object directoryIcon = LookAndFeel.makeIcon(getClass(), "icons/Directory.gif");
  253. Object fileIcon = LookAndFeel.makeIcon(getClass(), "icons/File.gif");
  254. Object computerIcon = LookAndFeel.makeIcon(getClass(), "icons/Computer.gif");
  255. Object hardDriveIcon = LookAndFeel.makeIcon(getClass(), "icons/HardDrive.gif");
  256. Object floppyDriveIcon = LookAndFeel.makeIcon(getClass(), "icons/FloppyDrive.gif");
  257. // *** InternalFrame value objects
  258. Object internalFrameBorder = new UIDefaults.LazyValue() {
  259. public Object createValue(UIDefaults table) {
  260. return new BorderUIResource.CompoundBorderUIResource(
  261. new BevelBorder(BevelBorder.RAISED,
  262. table.getColor("controlHighlight"),
  263. table.getColor("controlLtHighlight"),
  264. table.getColor("controlDkShadow"),
  265. table.getColor("controlShadow")),
  266. BorderFactory.createLineBorder(
  267. table.getColor("control"), 1));
  268. }
  269. };
  270. // *** List value objects
  271. Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
  272. public Object createValue(UIDefaults table) {
  273. return new DefaultListCellRenderer.UIResource();
  274. }
  275. };
  276. // *** Menus value objects
  277. Object menuBarBorder = new BasicBorders.MenuBarBorder(
  278. table.getColor("controlShadow"),
  279. table.getColor("controlLtHighlight")
  280. );
  281. Object menuItemCheckIcon = new UIDefaults.LazyValue() {
  282. public Object createValue(UIDefaults table) {
  283. return BasicIconFactory.getMenuItemCheckIcon();
  284. }
  285. };
  286. Object menuItemArrowIcon = new UIDefaults.LazyValue() {
  287. public Object createValue(UIDefaults table) {
  288. return BasicIconFactory.getMenuItemArrowIcon();
  289. }
  290. };
  291. Object menuArrowIcon = new UIDefaults.LazyValue() {
  292. public Object createValue(UIDefaults table) {
  293. return BasicIconFactory.getMenuArrowIcon();
  294. }
  295. };
  296. Object checkBoxIcon = new UIDefaults.LazyValue() {
  297. public Object createValue(UIDefaults table) {
  298. return BasicIconFactory.getCheckBoxIcon();
  299. }
  300. };
  301. Object radioButtonIcon = new UIDefaults.LazyValue() {
  302. public Object createValue(UIDefaults table) {
  303. return BasicIconFactory.getRadioButtonIcon();
  304. }
  305. };
  306. Object checkBoxMenuItemIcon = new UIDefaults.LazyValue() {
  307. public Object createValue(UIDefaults table) {
  308. return BasicIconFactory.getCheckBoxMenuItemIcon();
  309. }
  310. };
  311. Object radioButtonMenuItemIcon = new UIDefaults.LazyValue() {
  312. public Object createValue(UIDefaults table) {
  313. return BasicIconFactory.getRadioButtonMenuItemIcon();
  314. }
  315. };
  316. Object menuItemAcceleratorDelimiter = new String("+");
  317. // *** OptionPane value objects
  318. Object optionPaneMinimumSize = new DimensionUIResource(262, 90);
  319. Object optionPaneBorder = new BorderUIResource.EmptyBorderUIResource(10, 10, 12, 10);
  320. Object optionPaneButtonAreaBorder = new BorderUIResource.EmptyBorderUIResource(6,0,0,0);
  321. // *** ProgessBar value objects
  322. Object progressBarBorder = new BorderUIResource.LineBorderUIResource(Color.green, 2);
  323. // ** ScrollBar value objects
  324. Object minimumThumbSize = new UIDefaults.LazyValue() {
  325. public Object createValue(UIDefaults table) {
  326. return new DimensionUIResource(8,8);
  327. };
  328. };
  329. Object maximumThumbSize = new UIDefaults.LazyValue() {
  330. public Object createValue(UIDefaults table) {
  331. return new DimensionUIResource(4096,4096);
  332. };
  333. };
  334. // ** Slider value objects
  335. Object sliderFocusInsets = new InsetsUIResource( 2, 2, 2, 2 );
  336. Object toolBarSeparatorSize = new DimensionUIResource( 10, 10 );
  337. // *** SplitPane value objects
  338. Object splitPaneBorder = new BasicBorders.SplitPaneBorder(
  339. table.getColor("controlLtHighlight"),
  340. table.getColor("controlDkShadow"));
  341. // ** TabbedBane value objects
  342. Object tabbedPaneTabInsets = new InsetsUIResource(0, 4, 1, 4);
  343. Object tabbedPaneTabPadInsets = new InsetsUIResource(2, 2, 2, 1);
  344. Object tabbedPaneTabAreaInsets = new InsetsUIResource(3, 2, 0, 2);
  345. Object tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 3, 3);
  346. // *** Text value objects
  347. Object textFieldBorder = new BasicBorders.FieldBorder(
  348. table.getColor("controlShadow"),
  349. table.getColor("controlDkShadow"),
  350. table.getColor("controlHighlight"),
  351. table.getColor("controlLtHighlight"));
  352. Object editorMargin = new InsetsUIResource(3,3,3,3);
  353. JTextComponent.KeyBinding[] fieldBindings = makeKeyBindings( new Object[]{
  354. "ENTER", JTextField.notifyAction
  355. });
  356. JTextComponent.KeyBinding[] multilineBindings = makeKeyBindings( new Object[]{
  357. "UP", DefaultEditorKit.upAction,
  358. "DOWN", DefaultEditorKit.downAction,
  359. "PAGE_UP", DefaultEditorKit.pageUpAction,
  360. "PAGE_DOWN", DefaultEditorKit.pageDownAction,
  361. "ENTER", DefaultEditorKit.insertBreakAction,
  362. "TAB", DefaultEditorKit.insertTabAction
  363. });
  364. Object caretBlinkRate = new Integer(500);
  365. // *** Component Defaults
  366. Object[] defaults = {
  367. // *** Buttons
  368. "Button.font", dialogPlain12,
  369. "Button.background", table.get("control"),
  370. "Button.foreground", table.get("controlText"),
  371. "Button.border", buttonBorder,
  372. "Button.margin", new InsetsUIResource(2, 14, 2, 14),
  373. "Button.textIconGap", new Integer(4),
  374. "Button.textShiftOffset", new Integer(0),
  375. "ToggleButton.font", dialogPlain12,
  376. "ToggleButton.background", table.get("control"),
  377. "ToggleButton.foreground", table.get("controlText"),
  378. "ToggleButton.border", buttonToggleBorder,
  379. "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
  380. "ToggleButton.textIconGap", new Integer(4),
  381. "ToggleButton.textShiftOffset", new Integer(0),
  382. "RadioButton.font", dialogPlain12,
  383. "RadioButton.background", table.get("control"),
  384. "RadioButton.foreground", table.get("controlText"),
  385. "RadioButton.border", radioButtonBorder,
  386. "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2),
  387. "RadioButton.textIconGap", new Integer(4),
  388. "RadioButton.textShiftOffset", new Integer(0),
  389. "RadioButton.icon", radioButtonIcon,
  390. "CheckBox.font", dialogPlain12,
  391. "CheckBox.background", table.get("control"),
  392. "CheckBox.foreground", table.get("controlText"),
  393. "CheckBox.border", radioButtonBorder,
  394. "CheckBox.margin", new InsetsUIResource(2, 2, 2, 2),
  395. "CheckBox.textIconGap", new Integer(4),
  396. "CheckBox.textShiftOffset", new Integer(0),
  397. "CheckBox.icon", checkBoxIcon,
  398. // *** ColorChooser
  399. "ColorChooser.font", dialogPlain12,
  400. "ColorChooser.background", table.get("control"),
  401. "ColorChooser.foreground", table.get("controlText"),
  402. "ColorChooser.swatchesSwatchSize", new Dimension(10, 10),
  403. "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10),
  404. "ColorChooser.swatchesDefaultRecentColor", table.get("control"),
  405. "ColorChooser.rgbRedMnemonic", new Integer(KeyEvent.VK_R),
  406. "ColorChooser.rgbGreenMnemonic", new Integer(KeyEvent.VK_G),
  407. "ColorChooser.rgbBlueMnemonic", new Integer(KeyEvent.VK_B),
  408. // *** ComboBox
  409. "ComboBox.font", sansSerifPlain12,
  410. "ComboBox.background", white/*table.get("text")*/,
  411. "ComboBox.foreground", black/*table.get("TextText")*/,
  412. "ComboBox.selectionBackground", table.get("textHighlight"),
  413. "ComboBox.selectionForeground", table.get("textHighlightText"),
  414. "ComboBox.disabledBackground", table.get("control"),
  415. "ComboBox.disabledForeground", table.get("textInactiveText"),
  416. // *** FileChooser
  417. "FileChooser.cancelButtonMnemonic", new Integer(KeyEvent.VK_C),
  418. "FileChooser.saveButtonMnemonic", new Integer(KeyEvent.VK_S),
  419. "FileChooser.openButtonMnemonic", new Integer(KeyEvent.VK_O),
  420. "FileChooser.updateButtonMnemonic", new Integer(KeyEvent.VK_U),
  421. "FileChooser.helpButtonMnemonic", new Integer(KeyEvent.VK_H),
  422. "FileChooser.newFolderIcon", newFolderIcon,
  423. "FileChooser.upFolderIcon", upFolderIcon,
  424. "FileChooser.homeFolderIcon", homeFolderIcon,
  425. "FileChooser.detailsViewIcon", detailsViewIcon,
  426. "FileChooser.listViewIcon", listViewIcon,
  427. "FileView.directoryIcon", directoryIcon,
  428. "FileView.fileIcon", fileIcon,
  429. "FileView.computerIcon", computerIcon,
  430. "FileView.hardDriveIcon", hardDriveIcon,
  431. "FileView.floppyDriveIcon", floppyDriveIcon,
  432. // *** InternalFrame
  433. "InternalFrame.titleFont", dialogBold12,
  434. "InternalFrame.border", internalFrameBorder,
  435. "InternalFrame.icon", LookAndFeel.makeIcon(getClass(), "icons/JavaCup.gif"),
  436. /* Default frame icons are undefined for Basic. */
  437. "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(),
  438. "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(),
  439. "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(),
  440. "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(),
  441. "InternalFrame.activeTitleBackground", table.get("activeCaption"),
  442. "InternalFrame.activeTitleForeground", table.get("activeCaptionText"),
  443. "InternalFrame.inactiveTitleBackground", table.get("inactiveCaption"),
  444. "InternalFrame.inactiveTitleForeground", table.get("inactiveCaptionText"),
  445. "DesktopIcon.border", internalFrameBorder,
  446. "Desktop.background", table.get("desktop"),
  447. // *** Label
  448. "Label.font", dialogPlain12,
  449. "Label.background", table.get("control"),
  450. "Label.foreground", table.get("controlText"),
  451. "Label.disabledForeground", white,
  452. "Label.disabledShadow", table.get("controlShadow"),
  453. "Label.border", null,
  454. // *** List
  455. "List.font", dialogPlain12,
  456. "List.background", table.get("window"),
  457. "List.foreground", table.get("textText"),
  458. "List.selectionBackground", table.get("textHighlight"),
  459. "List.selectionForeground", table.get("textHighlightText"),
  460. "List.focusCellHighlightBorder", focusCellHighlightBorder,
  461. "List.border", null,
  462. "List.cellRenderer", listCellRendererActiveValue,
  463. // *** Menus
  464. "MenuBar.font", dialogPlain12,
  465. "MenuBar.background", table.get("menu"),
  466. "MenuBar.foreground", table.get("menuText"),
  467. "MenuBar.border", menuBarBorder,
  468. "MenuItem.font", dialogPlain12,
  469. "MenuItem.acceleratorFont", dialogPlain12,
  470. "MenuItem.background", table.get("menu"),
  471. "MenuItem.foreground", table.get("menuText"),
  472. "MenuItem.selectionForeground", table.get("textHighlightText"),
  473. "MenuItem.selectionBackground", table.get("textHighlight"),
  474. "MenuItem.disabledForeground", null,
  475. "MenuItem.acceleratorForeground", table.get("menuText"),
  476. "MenuItem.acceleratorSelectionForeground", table.get("textHighlightText"),
  477. "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
  478. "MenuItem.border", marginBorder,
  479. "MenuItem.borderPainted", Boolean.FALSE,
  480. "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
  481. "MenuItem.checkIcon", menuItemCheckIcon,
  482. "MenuItem.arrowIcon", menuItemArrowIcon,
  483. "RadioButtonMenuItem.font", dialogPlain12,
  484. "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
  485. "RadioButtonMenuItem.background", table.get("menu"),
  486. "RadioButtonMenuItem.foreground", table.get("menuText"),
  487. "RadioButtonMenuItem.selectionForeground", table.get("textHighlightText"),
  488. "RadioButtonMenuItem.selectionBackground", table.get("textHighlight"),
  489. "RadioButtonMenuItem.disabledForeground", null,
  490. "RadioButtonMenuItem.acceleratorForeground", table.get("menuText"),
  491. "RadioButtonMenuItem.acceleratorSelectionForeground", table.get("textHighlightText"),
  492. "RadioButtonMenuItem.border", marginBorder,
  493. "RadioButtonMenuItem.borderPainted", Boolean.FALSE,
  494. "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
  495. "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon,
  496. "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
  497. "CheckBoxMenuItem.font", dialogPlain12,
  498. "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
  499. "CheckBoxMenuItem.background", table.get("menu"),
  500. "CheckBoxMenuItem.foreground", table.get("menuText"),
  501. "CheckBoxMenuItem.selectionForeground", table.get("textHighlightText"),
  502. "CheckBoxMenuItem.selectionBackground", table.get("textHighlight"),
  503. "CheckBoxMenuItem.disabledForeground", null,
  504. "CheckBoxMenuItem.acceleratorForeground", table.get("menuText"),
  505. "CheckBoxMenuItem.acceleratorSelectionForeground", table.get("textHighlightText"),
  506. "CheckBoxMenuItem.border", marginBorder,
  507. "CheckBoxMenuItem.borderPainted", Boolean.FALSE,
  508. "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
  509. "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon,
  510. "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
  511. "Menu.font", dialogPlain12,
  512. "Menu.acceleratorFont", dialogPlain12,
  513. "Menu.background", table.get("menu"),
  514. "Menu.foreground", table.get("menuText"),
  515. "Menu.selectionForeground", table.get("textHighlightText"),
  516. "Menu.selectionBackground", table.get("textHighlight"),
  517. "Menu.disabledForeground", null,
  518. "Menu.acceleratorForeground", table.get("menuText"),
  519. "Menu.acceleratorSelectionForeground", table.get("textHighlightText"),
  520. "Menu.border", marginBorder,
  521. "Menu.borderPainted", Boolean.FALSE,
  522. "Menu.margin", new InsetsUIResource(2, 2, 2, 2),
  523. "Menu.checkIcon", menuItemCheckIcon,
  524. "Menu.arrowIcon", menuArrowIcon,
  525. "Menu.consumesTabs", Boolean.TRUE,
  526. "PopupMenu.font", dialogPlain12,
  527. "PopupMenu.background", table.get("menu"),
  528. "PopupMenu.foreground", table.get("menuText"),
  529. "PopupMenu.border", raisedBevelBorder,
  530. // *** OptionPane
  531. "OptionPane.font", dialogPlain12,
  532. "OptionPane.background", table.get("control"),
  533. "OptionPane.foreground", table.get("controlText"),
  534. "OptionPane.messageForeground", table.get("controlText"),
  535. "OptionPane.border", optionPaneBorder,
  536. "OptionPane.messageAreaBorder", zeroBorder,
  537. "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
  538. "OptionPane.minimumSize", optionPaneMinimumSize,
  539. "OptionPane.errorIcon", LookAndFeel.makeIcon(getClass(), "icons/Error.gif"),
  540. "OptionPane.informationIcon", LookAndFeel.makeIcon(getClass(), "icons/Inform.gif"),
  541. "OptionPane.warningIcon", LookAndFeel.makeIcon(getClass(), "icons/Warn.gif"),
  542. "OptionPane.questionIcon", LookAndFeel.makeIcon(getClass(), "icons/Question.gif"),
  543. // *** Panel
  544. "Panel.font", dialogPlain12,
  545. "Panel.background", table.get("control"),
  546. "Panel.foreground", table.get("textText"),
  547. // *** ProgressBar
  548. "ProgressBar.font", dialogPlain12,
  549. "ProgressBar.foreground", table.get("textHighlight"),
  550. "ProgressBar.background", table.get("control"),
  551. "ProgressBar.selectionForeground", table.get("control"),
  552. "ProgressBar.selectionBackground", table.get("textHighlight"),
  553. "ProgressBar.border", progressBarBorder,
  554. "ProgressBar.cellLength", new Integer(1),
  555. "ProgressBar.cellSpacing", new Integer(0),
  556. // *** Separator
  557. "Separator.shadow", table.get("controlShadow"), // DEPRECATED - DO NOT USE!
  558. "Separator.highlight", table.get("controlLtHighlight"), // DEPRECATED - DO NOT USE!
  559. "Separator.background", table.get("controlLtHighlight"),
  560. "Separator.foreground", table.get("controlShadow"),
  561. // *** ScrollBar/ScrollPane/Viewport
  562. "ScrollBar.background", scrollBarTrack,
  563. "ScrollBar.foreground", table.get("control"),
  564. "ScrollBar.track", table.get("scrollbar"),
  565. "ScrollBar.trackHighlight", table.get("controlDkShadow"),
  566. "ScrollBar.thumb", table.get("control"),
  567. "ScrollBar.thumbHighlight", table.get("controlLtHighlight"),
  568. "ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
  569. "ScrollBar.thumbLightShadow", table.get("controlShadow"),
  570. "ScrollBar.border", null,
  571. "ScrollBar.minimumThumbSize", minimumThumbSize,
  572. "ScrollBar.maximumThumbSize", maximumThumbSize,
  573. "ScrollPane.font", dialogPlain12,
  574. "ScrollPane.background", table.get("control"),
  575. "ScrollPane.foreground", table.get("controlText"),
  576. "ScrollPane.border", etchedBorder,
  577. "ScrollPane.viewportBorder", null,
  578. "Viewport.font", dialogPlain12,
  579. "Viewport.background", table.get("control"),
  580. "Viewport.foreground", table.get("textText"),
  581. // *** Slider
  582. "Slider.foreground", table.get("control"),
  583. "Slider.background", table.get("control"),
  584. "Slider.highlight", table.get("controlLtHighlight"),
  585. "Slider.shadow", table.get("controlShadow"),
  586. "Slider.focus", table.get("controlDkShadow"),
  587. "Slider.border", null,
  588. "Slider.focusInsets", sliderFocusInsets,
  589. // *** SplitPane
  590. "SplitPane.background", table.get("control"),
  591. "SplitPane.highlight", table.get("controlLtHighlight"),
  592. "SplitPane.shadow", table.get("controlShadow"),
  593. "SplitPane.border", splitPaneBorder,
  594. "SplitPane.dividerSize", new Integer(5),
  595. // *** TabbedPane
  596. "TabbedPane.font", dialogPlain12,
  597. "TabbedPane.background", table.get("control"),
  598. "TabbedPane.foreground", table.get("controlText"),
  599. "TabbedPane.lightHighlight", table.get("controlLtHighlight"),
  600. "TabbedPane.highlight", table.get("controlHighlight"),
  601. "TabbedPane.shadow", table.get("controlShadow"),
  602. "TabbedPane.darkShadow", table.get("controlDkShadow"),
  603. "TabbedPane.focus", table.get("controlText"),
  604. "TabbedPane.textIconGap", new Integer(4),
  605. "TabbedPane.tabInsets", tabbedPaneTabInsets,
  606. "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
  607. "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
  608. "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
  609. "TabbedPane.tabRunOverlay", new Integer(2),
  610. // *** Table
  611. "Table.font", dialogPlain12,
  612. "Table.foreground", table.get("controlText"), // cell text color
  613. "Table.background", table.get("window"), // cell background color
  614. "Table.selectionForeground", table.get("textHighlightText"),
  615. "Table.selectionBackground", table.get("textHighlight"),
  616. "Table.gridColor", gray, // grid line color
  617. "Table.focusCellBackground", table.get("window"),
  618. "Table.focusCellForeground", table.get("controlText"),
  619. "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  620. "Table.scrollPaneBorder", loweredBevelBorder,
  621. "TableHeader.font", dialogPlain12,
  622. "TableHeader.foreground", table.get("controlText"), // header text color
  623. "TableHeader.background", table.get("control"), // header background
  624. "TableHeader.cellBorder", raisedBevelBorder,
  625. // *** Text
  626. "TextField.font", sansSerifPlain12,
  627. "TextField.background", table.get("window"),
  628. "TextField.foreground", table.get("textText"),
  629. "TextField.inactiveForeground", table.get("textInactiveText"),
  630. "TextField.selectionBackground", table.get("textHighlight"),
  631. "TextField.selectionForeground", table.get("textHighlightText"),
  632. "TextField.caretForeground", table.get("textText"),
  633. "TextField.caretBlinkRate", caretBlinkRate,
  634. "TextField.border", textFieldBorder,
  635. "TextField.margin", zeroInsets,
  636. "TextField.keyBindings", fieldBindings,
  637. "PasswordField.font", monospacedPlain12,
  638. "PasswordField.background", table.get("window"),
  639. "PasswordField.foreground", table.get("textText"),
  640. "PasswordField.inactiveForeground", table.get("textInactiveText"),
  641. "PasswordField.selectionBackground", table.get("textHighlight"),
  642. "PasswordField.selectionForeground", table.get("textHighlightText"),
  643. "PasswordField.caretForeground", table.get("textText"),
  644. "PasswordField.caretBlinkRate", caretBlinkRate,
  645. "PasswordField.border", textFieldBorder,
  646. "PasswordField.margin", zeroInsets,
  647. "PasswordField.keyBindings", fieldBindings,
  648. "TextArea.font", monospacedPlain12,
  649. "TextArea.background", table.get("window"),
  650. "TextArea.foreground", table.get("textText"),
  651. "TextArea.inactiveForeground", table.get("textInactiveText"),
  652. "TextArea.selectionBackground", table.get("textHighlight"),
  653. "TextArea.selectionForeground", table.get("textHighlightText"),
  654. "TextArea.caretForeground", table.get("textText"),
  655. "TextArea.caretBlinkRate", caretBlinkRate,
  656. "TextArea.border", marginBorder,
  657. "TextArea.margin", zeroInsets,
  658. "TextArea.keyBindings", multilineBindings,
  659. "TextPane.font", serifPlain12,
  660. "TextPane.background", white,
  661. "TextPane.foreground", table.get("textText"),
  662. "TextPane.selectionBackground", lightGray,
  663. "TextPane.selectionForeground", table.get("textHighlightText"),
  664. "TextPane.caretForeground", table.get("textText"),
  665. "TextPane.caretBlinkRate", caretBlinkRate,
  666. "TextPane.inactiveForeground", table.get("textInactiveText"),
  667. "TextPane.border", marginBorder,
  668. "TextPane.margin", editorMargin,
  669. "TextPane.keyBindings", multilineBindings,
  670. "EditorPane.font", serifPlain12,
  671. "EditorPane.background", white,
  672. "EditorPane.foreground", table.get("textText"),
  673. "EditorPane.selectionBackground", lightGray,
  674. "EditorPane.selectionForeground", table.get("textHighlightText"),
  675. "EditorPane.caretForeground", red,
  676. "EditorPane.caretBlinkRate", caretBlinkRate,
  677. "EditorPane.inactiveForeground", table.get("textInactiveText"),
  678. "EditorPane.border", marginBorder,
  679. "EditorPane.margin", editorMargin,
  680. "EditorPane.keyBindings", multilineBindings,
  681. // *** TitledBorder
  682. "TitledBorder.font", dialogPlain12,
  683. "TitledBorder.titleColor", table.get("controlText"),
  684. "TitledBorder.border", etchedBorder,
  685. // *** ToolBar
  686. "ToolBar.font", dialogPlain12,
  687. "ToolBar.background", table.get("control"),
  688. "ToolBar.foreground", table.get("controlText"),
  689. "ToolBar.dockingBackground", table.get("control"),
  690. "ToolBar.dockingForeground", red,
  691. "ToolBar.floatingBackground", table.get("control"),
  692. "ToolBar.floatingForeground", darkGray,
  693. "ToolBar.border", etchedBorder,
  694. "ToolBar.separatorSize", toolBarSeparatorSize,
  695. // *** ToolTips
  696. "ToolTip.font", sansSerifPlain12,
  697. "ToolTip.background", table.get("info"),
  698. "ToolTip.foreground", table.get("infoText"),
  699. "ToolTip.border", blackLineBorder,
  700. // *** Tree
  701. "Tree.font", dialogPlain12,
  702. "Tree.background", table.get("window"),
  703. "Tree.foreground", table.get("textText"),
  704. "Tree.hash", gray,
  705. "Tree.textForeground", table.get("textText"),
  706. "Tree.textBackground", table.get("text"),
  707. "Tree.selectionForeground", table.get("textHighlightText"),
  708. "Tree.selectionBackground", table.get("textHighlight"),
  709. "Tree.selectionBorderColor", black,
  710. "Tree.editorBorder", blackLineBorder,
  711. "Tree.leftChildIndent", new Integer(7),
  712. "Tree.rightChildIndent", new Integer(13),
  713. "Tree.rowHeight", new Integer(16),
  714. "Tree.scrollsOnExpand", Boolean.TRUE,
  715. "Tree.openIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeOpen.gif"),
  716. "Tree.closedIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeClosed.gif"),
  717. "Tree.leafIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeLeaf.gif"),
  718. "Tree.expandedIcon", null,
  719. "Tree.collapsedIcon", null,
  720. "Tree.changeSelectionWithFocus", Boolean.TRUE,
  721. "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE,
  722. };
  723. table.putDefaults(defaults);
  724. }
  725. }