1. /*
  2. * @(#)MetalLookAndFeel.java 1.118 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.plaf.metal;
  11. import java.awt.*;
  12. import javax.swing.plaf.*;
  13. import javax.swing.*;
  14. import javax.swing.plaf.basic.*;
  15. import javax.swing.border.*;
  16. import javax.swing.text.JTextComponent;
  17. import javax.swing.text.DefaultEditorKit;
  18. import java.util.*;
  19. import java.awt.Font;
  20. import java.awt.Color;
  21. import java.awt.SystemColor;
  22. import java.awt.event.KeyEvent;
  23. import java.awt.event.InputEvent;
  24. import java.net.URL;
  25. import java.io.Serializable;
  26. /**
  27. * Implements The Metal Look and Feel.
  28. * <p>
  29. * For the keyboard keys defined for each component in this Look and
  30. * Feel (L&F), see
  31. * <a href="../../doc-files/Key-Metal.html">Component Keystroke Actions for the Metal L&F</a>.
  32. * <p>
  33. * <strong>Warning:</strong>
  34. * Serialized objects of this class will not be compatible with
  35. * future Swing releases. The current serialization support is appropriate
  36. * for short term storage or RMI between applications running the same
  37. * version of Swing. A future release of Swing will provide support for
  38. * long term persistence.
  39. *
  40. * @version @(#)MetalLookAndFeel.java 1.118 00/02/02
  41. * @author Steve Wilson
  42. */
  43. public class MetalLookAndFeel extends BasicLookAndFeel
  44. {
  45. private static MetalTheme currentTheme;
  46. private static boolean isOnlyOneContext = true;
  47. private static sun.awt.AppContext cachedAppContext = sun.awt.AppContext.getAppContext();
  48. public String getName() {
  49. return "Metal";
  50. }
  51. public String getID() {
  52. return "Metal";
  53. }
  54. public String getDescription() {
  55. return "The Java(tm) Look and Feel";
  56. }
  57. public boolean isNativeLookAndFeel() {
  58. return false;
  59. }
  60. public boolean isSupportedLookAndFeel() {
  61. return true;
  62. }
  63. /**
  64. * Initialize the uiClassID to BasicComponentUI mapping.
  65. * The JComponent classes define their own uiClassID constants
  66. * (see AbstractComponent.getUIClassID). This table must
  67. * map those constants to a BasicComponentUI class of the
  68. * appropriate type.
  69. *
  70. * @see BasicLookAndFeel#getDefaults
  71. */
  72. protected void initClassDefaults(UIDefaults table)
  73. {
  74. super.initClassDefaults(table);
  75. // String basicPackageName = "javax.swing.plaf.basic.";
  76. String metalPackageName = "javax.swing.plaf.metal.";
  77. Object[] uiDefaults = {
  78. "ButtonUI", metalPackageName + "MetalButtonUI",
  79. "CheckBoxUI", metalPackageName + "MetalCheckBoxUI",
  80. "RadioButtonUI", metalPackageName + "MetalRadioButtonUI",
  81. "ToggleButtonUI", metalPackageName + "MetalToggleButtonUI",
  82. "ProgressBarUI", metalPackageName + "MetalProgressBarUI",
  83. "ScrollBarUI", metalPackageName + "MetalScrollBarUI",
  84. "ScrollPaneUI", metalPackageName + "MetalScrollPaneUI",
  85. "SplitPaneUI", metalPackageName + "MetalSplitPaneUI",
  86. "SliderUI", metalPackageName + "MetalSliderUI",
  87. "SeparatorUI", metalPackageName + "MetalSeparatorUI",
  88. "PopupMenuSeparatorUI", metalPackageName + "MetalPopupMenuSeparatorUI",
  89. "TabbedPaneUI", metalPackageName + "MetalTabbedPaneUI",
  90. "TextFieldUI", metalPackageName + "MetalTextFieldUI",
  91. "TreeUI", metalPackageName + "MetalTreeUI",
  92. "LabelUI", metalPackageName + "MetalLabelUI",
  93. "ToolBarUI", metalPackageName + "MetalToolBarUI",
  94. "ToolTipUI", metalPackageName + "MetalToolTipUI",
  95. "ComboBoxUI", metalPackageName + "MetalComboBoxUI",
  96. "InternalFrameUI", metalPackageName + "MetalInternalFrameUI",
  97. "DesktopIconUI", metalPackageName + "MetalDesktopIconUI",
  98. "FileChooserUI", metalPackageName + "MetalFileChooserUI",
  99. };
  100. table.putDefaults(uiDefaults);
  101. }
  102. /**
  103. * Load the SystemColors into the defaults table. The keys
  104. * for SystemColor defaults are the same as the names of
  105. * the public fields in SystemColor.
  106. */
  107. protected void initSystemColorDefaults(UIDefaults table)
  108. {
  109. Object[] systemColors = {
  110. "desktop", getDesktopColor(), /* Color of the desktop background */
  111. "activeCaption", getWindowTitleBackground(), /* Color for captions (title bars) when they are active. */
  112. "activeCaptionText", getWindowTitleForeground(), /* Text color for text in captions (title bars). */
  113. "activeCaptionBorder", getPrimaryControlShadow(), /* Border color for caption (title bar) window borders. */
  114. "inactiveCaption", getWindowTitleInactiveBackground(), /* Color for captions (title bars) when not active. */
  115. "inactiveCaptionText", getWindowTitleInactiveForeground(), /* Text color for text in inactive captions (title bars). */
  116. "inactiveCaptionBorder", getControlShadow(), /* Border color for inactive caption (title bar) window borders. */
  117. "window", getWindowBackground(), /* Default color for the interior of windows */
  118. "windowBorder", getControl(), /* ??? */
  119. "windowText", getUserTextColor(), /* ??? */
  120. "menu", getMenuBackground(), /* Background color for menus */
  121. "menuText", getMenuForeground(), /* Text color for menus */
  122. "text", getWindowBackground(), /* Text background color */
  123. "textText", getUserTextColor(), /* Text foreground color */
  124. "textHighlight", getTextHighlightColor(), /* Text background color when selected */
  125. "textHighlightText", getHighlightedTextColor(), /* Text color when selected */
  126. "textInactiveText", getInactiveSystemTextColor(), /* Text color when disabled */
  127. "control", getControl(), /* Default color for controls (buttons, sliders, etc) */
  128. "controlText", getControlTextColor(), /* Default color for text in controls */
  129. "controlHighlight", getControlHighlight(), /* Specular highlight (opposite of the shadow) */
  130. "controlLtHighlight", getControlHighlight(), /* Highlight color for controls */
  131. "controlShadow", getControlShadow(), /* Shadow color for controls */
  132. "controlDkShadow", getControlDarkShadow(), /* Dark shadow color for controls */
  133. "scrollbar", getControl(), /* Scrollbar background (usually the "track") */
  134. "info", getPrimaryControl(), /* ToolTip Background */
  135. "infoText", getPrimaryControlInfo() /* ToolTip Text */
  136. };
  137. for(int i = 0; i < systemColors.length; i += 2) {
  138. table.put((String)systemColors[i], systemColors[i + 1]);
  139. }
  140. }
  141. private void loadResourceBundle(UIDefaults table) {
  142. ResourceBundle bundle = ResourceBundle.getBundle("javax.swing.plaf.metal.resources.metal");
  143. Enumeration iter = bundle.getKeys();
  144. while(iter.hasMoreElements()) {
  145. String key = (String)iter.nextElement();
  146. //System.out.println("key :" +key+ " value: " + bundle.getObject(key));
  147. table.put( key, bundle.getObject(key) );
  148. }
  149. }
  150. protected void initComponentDefaults(UIDefaults table) {
  151. super.initComponentDefaults( table );
  152. loadResourceBundle(table);
  153. Object textFieldBorder =
  154. new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders",
  155. "getTextFieldBorder");
  156. Object textBorder =
  157. new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders",
  158. "getTextBorder");
  159. Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
  160. "ctrl C", DefaultEditorKit.copyAction,
  161. "ctrl V", DefaultEditorKit.pasteAction,
  162. "ctrl X", DefaultEditorKit.cutAction,
  163. "COPY", DefaultEditorKit.copyAction,
  164. "PASTE", DefaultEditorKit.pasteAction,
  165. "CUT", DefaultEditorKit.cutAction,
  166. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  167. "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
  168. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  169. "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
  170. "ctrl LEFT", DefaultEditorKit.previousWordAction,
  171. "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
  172. "ctrl RIGHT", DefaultEditorKit.nextWordAction,
  173. "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
  174. "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  175. "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
  176. "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  177. "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
  178. "ctrl A", DefaultEditorKit.selectAllAction,
  179. "HOME", DefaultEditorKit.beginLineAction,
  180. "END", DefaultEditorKit.endLineAction,
  181. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  182. "shift END", DefaultEditorKit.selectionEndLineAction,
  183. "typed \010", DefaultEditorKit.deletePrevCharAction,
  184. "DELETE", DefaultEditorKit.deleteNextCharAction,
  185. "RIGHT", DefaultEditorKit.forwardAction,
  186. "LEFT", DefaultEditorKit.backwardAction,
  187. "KP_RIGHT", DefaultEditorKit.forwardAction,
  188. "KP_LEFT", DefaultEditorKit.backwardAction,
  189. "ENTER", JTextField.notifyAction,
  190. "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
  191. "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
  192. });
  193. Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
  194. "ctrl C", DefaultEditorKit.copyAction,
  195. "ctrl V", DefaultEditorKit.pasteAction,
  196. "ctrl X", DefaultEditorKit.cutAction,
  197. "COPY", DefaultEditorKit.copyAction,
  198. "PASTE", DefaultEditorKit.pasteAction,
  199. "CUT", DefaultEditorKit.cutAction,
  200. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  201. "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
  202. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  203. "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
  204. "ctrl LEFT", DefaultEditorKit.previousWordAction,
  205. "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
  206. "ctrl RIGHT", DefaultEditorKit.nextWordAction,
  207. "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
  208. "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  209. "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
  210. "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  211. "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
  212. "ctrl A", DefaultEditorKit.selectAllAction,
  213. "HOME", DefaultEditorKit.beginLineAction,
  214. "END", DefaultEditorKit.endLineAction,
  215. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  216. "shift END", DefaultEditorKit.selectionEndLineAction,
  217. "UP", DefaultEditorKit.upAction,
  218. "KP_UP", DefaultEditorKit.upAction,
  219. "DOWN", DefaultEditorKit.downAction,
  220. "KP_DOWN", DefaultEditorKit.downAction,
  221. "PAGE_UP", DefaultEditorKit.pageUpAction,
  222. "PAGE_DOWN", DefaultEditorKit.pageDownAction,
  223. "shift PAGE_UP", "selection-page-up",
  224. "shift PAGE_DOWN", "selection-page-down",
  225. "ctrl shift PAGE_UP", "selection-page-left",
  226. "ctrl shift PAGE_DOWN", "selection-page-right",
  227. "shift UP", DefaultEditorKit.selectionUpAction,
  228. "shift KP_UP", DefaultEditorKit.selectionUpAction,
  229. "shift DOWN", DefaultEditorKit.selectionDownAction,
  230. "shift KP_DOWN", DefaultEditorKit.selectionDownAction,
  231. "ENTER", DefaultEditorKit.insertBreakAction,
  232. "typed \010", DefaultEditorKit.deletePrevCharAction,
  233. "DELETE", DefaultEditorKit.deleteNextCharAction,
  234. "RIGHT", DefaultEditorKit.forwardAction,
  235. "LEFT", DefaultEditorKit.backwardAction,
  236. "KP_RIGHT", DefaultEditorKit.forwardAction,
  237. "KP_LEFT", DefaultEditorKit.backwardAction,
  238. "TAB", DefaultEditorKit.insertTabAction,
  239. "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
  240. "ctrl HOME", DefaultEditorKit.beginAction,
  241. "ctrl END", DefaultEditorKit.endAction,
  242. "ctrl shift HOME", DefaultEditorKit.selectionBeginAction,
  243. "ctrl shift END", DefaultEditorKit.selectionEndAction,
  244. "ctrl T", "next-link-action",
  245. "ctrl shift T", "previous-link-action",
  246. "ctrl SPACE", "activate-link-action",
  247. "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
  248. });
  249. Object scrollPaneBorder = new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders$ScrollPaneBorder");
  250. Object buttonBorder =
  251. new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders",
  252. "getButtonBorder");
  253. Object toggleButtonBorder =
  254. new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders",
  255. "getToggleButtonBorder");
  256. Object titledBorderBorder =
  257. new UIDefaults.ProxyLazyValue(
  258. "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
  259. new Object[] {table.getColor("controlShadow")});
  260. Object desktopIconBorder =
  261. new UIDefaults.ProxyLazyValue(
  262. "javax.swing.plaf.metal.MetalBorders",
  263. "getDesktopIconBorder");
  264. Object menuBarBorder =
  265. new UIDefaults.ProxyLazyValue(
  266. "javax.swing.plaf.metal.MetalBorders$MenuBarBorder");
  267. Object popupMenuBorder =
  268. new UIDefaults.ProxyLazyValue(
  269. "javax.swing.plaf.metal.MetalBorders$PopupMenuBorder");
  270. Object menuItemBorder =
  271. new UIDefaults.ProxyLazyValue(
  272. "javax.swing.plaf.metal.MetalBorders$MenuItemBorder");
  273. Object menuItemAcceleratorDelimiter = new String("-");
  274. Object toolBarBorder = new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders$ToolBarBorder");
  275. Object progressBarBorder = new UIDefaults.ProxyLazyValue(
  276. "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
  277. new Object[] {getControlDarkShadow(), new Integer(1)});
  278. Object toolTipBorder = new UIDefaults.ProxyLazyValue(
  279. "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
  280. new Object[] {getPrimaryControlDarkShadow()});
  281. Object focusCellHighlightBorder = new UIDefaults.ProxyLazyValue(
  282. "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
  283. new Object[] {getFocusColor()});
  284. Object tabbedPaneTabAreaInsets = new InsetsUIResource(4, 2, 0, 6);
  285. Object sliderFocusInsets = new InsetsUIResource( 0, 0, 0, 0 );
  286. final Object[] internalFrameIconArgs = new Object[1];
  287. internalFrameIconArgs[0] = new Integer(16);
  288. //
  289. // DEFAULTS TABLE
  290. //
  291. Object[] defaults = {
  292. // Text (Note: many are inherited)
  293. "TextField.border", textFieldBorder,
  294. "TextField.font", new UIDefaults.ProxyLazyValue(
  295. "javax.swing.plaf.metal.MetalLookAndFeel",
  296. "getUserTextFont"),
  297. "TextField.caretForeground", getUserTextColor(),
  298. "PasswordField.border", textBorder,
  299. "PasswordField.font", new UIDefaults.ProxyLazyValue(
  300. "javax.swing.plaf.metal.MetalLookAndFeel",
  301. "getUserTextFont"),
  302. "PasswordField.caretForeground", getUserTextColor(),
  303. "TextArea.font", new UIDefaults.ProxyLazyValue(
  304. "javax.swing.plaf.metal.MetalLookAndFeel",
  305. "getUserTextFont"),
  306. "TextArea.caretForeground", getUserTextColor(),
  307. "TextPane.selectionBackground", table.get("textHighlight"),
  308. "TextPane.selectionForeground", table.get("textHighlightText"),
  309. "TextPane.background", table.get("window"),
  310. "TextPane.foreground", table.get("textText"),
  311. "TextPane.font", new UIDefaults.ProxyLazyValue(
  312. "javax.swing.plaf.metal.MetalLookAndFeel",
  313. "getUserTextFont"),
  314. "TextPane.caretForeground", getUserTextColor(),
  315. "EditorPane.selectionBackground", table.get("textHighlight"),
  316. "EditorPane.selectionForeground", table.get("textHighlightText"),
  317. "EditorPane.background", table.get("window"),
  318. "EditorPane.foreground", table.get("textText"),
  319. "EditorPane.font", new UIDefaults.ProxyLazyValue(
  320. "javax.swing.plaf.metal.MetalLookAndFeel",
  321. "getUserTextFont"),
  322. "EditorPane.caretForeground", getUserTextColor(),
  323. "TextField.focusInputMap", fieldInputMap,
  324. "PasswordField.focusInputMap", fieldInputMap,
  325. "TextArea.focusInputMap", multilineInputMap,
  326. "TextPane.focusInputMap", multilineInputMap,
  327. "EditorPane.focusInputMap", multilineInputMap,
  328. // Buttons
  329. "Button.background", getControl(),
  330. "Button.foreground", getControlTextColor(),
  331. "Button.disabledText", getInactiveControlTextColor(),
  332. "Button.select", getControlShadow(),
  333. "Button.border", buttonBorder,
  334. "Button.font", new UIDefaults.ProxyLazyValue(
  335. "javax.swing.plaf.metal.MetalLookAndFeel",
  336. "getControlTextFont"),
  337. "Button.focus", getFocusColor(),
  338. "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
  339. "SPACE", "pressed",
  340. "released SPACE", "released"
  341. }),
  342. "CheckBox.background", getControl(),
  343. "CheckBox.foreground", getControlTextColor(),
  344. "CheckBox.disabledText", getInactiveControlTextColor(),
  345. "Checkbox.select", getControlShadow(),
  346. "CheckBox.font", new UIDefaults.ProxyLazyValue(
  347. "javax.swing.plaf.metal.MetalLookAndFeel",
  348. "getControlTextFont"),
  349. "CheckBox.focus", getFocusColor(),
  350. "CheckBox.icon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getCheckBoxIcon"),
  351. "CheckBox.focusInputMap",
  352. new UIDefaults.LazyInputMap(new Object[] {
  353. "SPACE", "pressed",
  354. "released SPACE", "released"
  355. }),
  356. "RadioButton.background", getControl(),
  357. "RadioButton.foreground", getControlTextColor(),
  358. "RadioButton.disabledText", getInactiveControlTextColor(),
  359. "RadioButton.select", getControlShadow(),
  360. "RadioButton.icon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonIcon"),
  361. "RadioButton.font", new UIDefaults.ProxyLazyValue(
  362. "javax.swing.plaf.metal.MetalLookAndFeel",
  363. "getControlTextFont"),
  364. "RadioButton.focus", getFocusColor(),
  365. "RadioButton.focusInputMap",
  366. new UIDefaults.LazyInputMap(new Object[] {
  367. "SPACE", "pressed",
  368. "released SPACE", "released"
  369. }),
  370. "ToggleButton.background", getControl(),
  371. "ToggleButton.foreground", getControlTextColor(),
  372. "ToggleButton.select", getControlShadow(),
  373. "ToggleButton.text", getControl(),
  374. "ToggleButton.disabledText", getInactiveControlTextColor(),
  375. "ToggleButton.disabledSelectedText", getControlDarkShadow(),
  376. "ToggleButton.disabledBackground", getControl(),
  377. "ToggleButton.disabledSelectedBackground", getControlShadow(),
  378. "ToggleButton.focus", getFocusColor(),
  379. "ToggleButton.border", toggleButtonBorder,
  380. "ToggleButton.font", new UIDefaults.ProxyLazyValue(
  381. "javax.swing.plaf.metal.MetalLookAndFeel",
  382. "getControlTextFont"),
  383. "ToggleButton.focusInputMap",
  384. new UIDefaults.LazyInputMap(new Object[] {
  385. "SPACE", "pressed",
  386. "released SPACE", "released"
  387. }),
  388. // File View
  389. "FileView.directoryIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"),
  390. "FileView.fileIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeLeafIcon"),
  391. "FileView.computerIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeComputerIcon"),
  392. "FileView.hardDriveIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeHardDriveIcon"),
  393. "FileView.floppyDriveIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFloppyDriveIcon"),
  394. // File Chooser
  395. "FileChooser.detailsViewIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserDetailViewIcon"),
  396. "FileChooser.homeFolderIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserHomeFolderIcon"),
  397. "FileChooser.listViewIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserListViewIcon"),
  398. "FileChooser.newFolderIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserNewFolderIcon"),
  399. "FileChooser.upFolderIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserUpFolderIcon"),
  400. "FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I),
  401. "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N),
  402. "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),
  403. "FileChooser.ancestorInputMap",
  404. new UIDefaults.LazyInputMap(new Object[] {
  405. "ESCAPE", "cancelSelection"
  406. }),
  407. // ToolTip
  408. "ToolTip.font", new UIDefaults.ProxyLazyValue(
  409. "javax.swing.plaf.metal.MetalLookAndFeel",
  410. "getSystemTextFont"),
  411. "ToolTip.border", toolTipBorder,
  412. "ToolTip.background", table.get("info"),
  413. "ToolTip.foreground", table.get("infoText"),
  414. // Slider Defaults
  415. "Slider.border", null,
  416. "Slider.foreground", getPrimaryControlShadow(),
  417. "Slider.background", getControl(),
  418. "Slider.focus", getFocusColor(),
  419. "Slider.focusInsets", sliderFocusInsets,
  420. "Slider.trackWidth", new Integer( 7 ),
  421. "Slider.majorTickLength", new Integer( 6 ),
  422. "Slider.horizontalThumbIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getHorizontalSliderThumbIcon"),
  423. "Slider.verticalThumbIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getVerticalSliderThumbIcon"),
  424. "Slider.focusInputMap",
  425. new UIDefaults.LazyInputMap(new Object[] {
  426. "RIGHT", "positiveUnitIncrement",
  427. "KP_RIGHT", "positiveUnitIncrement",
  428. "DOWN", "negativeUnitIncrement",
  429. "KP_DOWN", "negativeUnitIncrement",
  430. "PAGE_DOWN", "negativeBlockIncrement",
  431. "ctrl PAGE_DOWN", "negativeBlockIncrement",
  432. "LEFT", "negativeUnitIncrement",
  433. "KP_LEFT", "negativeUnitIncrement",
  434. "UP", "positiveUnitIncrement",
  435. "KP_UP", "positiveUnitIncrement",
  436. "PAGE_UP", "positiveBlockIncrement",
  437. "ctrl PAGE_UP", "positiveBlockIncrement",
  438. "HOME", "minScroll",
  439. "END", "maxScroll"
  440. }),
  441. // Progress Bar
  442. "ProgressBar.font", new UIDefaults.ProxyLazyValue(
  443. "javax.swing.plaf.metal.MetalLookAndFeel",
  444. "getControlTextFont"),
  445. "ProgressBar.foreground", getPrimaryControlShadow(),
  446. "ProgressBar.background", getControl(),
  447. "ProgressBar.foregroundHighlight", getPrimaryControlShadow(),
  448. "ProgressBar.backgroundHighlight", getControl(),
  449. "ProgressBar.selectionForeground", getControl(),
  450. "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
  451. "ProgressBar.border", progressBarBorder,
  452. "ProgressBar.cellSpacing", new Integer(0),
  453. "ProgressBar.cellLength", new Integer(1),
  454. // Combo Box
  455. "ComboBox.background", table.get("control"),
  456. "ComboBox.foreground", table.get("controlText"),
  457. "ComboBox.selectionBackground", getPrimaryControlShadow(),
  458. "ComboBox.selectionForeground", getControlTextColor(),
  459. "ComboBox.listBackground", getControl(),
  460. "ComboBox.listForeground", getControlTextColor(),
  461. "ComboBox.font", new UIDefaults.ProxyLazyValue(
  462. "javax.swing.plaf.metal.MetalLookAndFeel",
  463. "getControlTextFont"),
  464. "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
  465. "ESCAPE", "hidePopup",
  466. "PAGE_UP", "pageUpPassThrough",
  467. "PAGE_DOWN", "pageDownPassThrough",
  468. "HOME", "homePassThrough",
  469. "END", "endPassThrough",
  470. "DOWN", "selectNext",
  471. "KP_DOWN", "selectNext",
  472. "alt DOWN", "togglePopup",
  473. "alt KP_DOWN", "togglePopup",
  474. "alt UP", "togglePopup",
  475. "alt KP_UP", "togglePopup",
  476. "UP", "selectPrevious",
  477. "KP_UP", "selectPrevious"
  478. }),
  479. // Internal Frame Defaults
  480. "InternalFrame.icon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getInternalFrameDefaultMenuIcon"),
  481. "InternalFrame.border", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders$InternalFrameBorder"),
  482. "InternalFrame.optionDialogBorder", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders$OptionDialogBorder"),
  483. "InternalFrame.paletteBorder", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders$PaletteBorder"),
  484. "InternalFrame.paletteTitleHeight", new Integer(11),
  485. "InternalFrame.paletteCloseIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory$PaletteCloseIcon"),
  486. "InternalFrame.closeIcon",
  487. new UIDefaults.ProxyLazyValue(
  488. "javax.swing.plaf.metal.MetalIconFactory",
  489. "getInternalFrameCloseIcon",
  490. internalFrameIconArgs),
  491. "InternalFrame.maximizeIcon",
  492. new UIDefaults.ProxyLazyValue(
  493. "javax.swing.plaf.metal.MetalIconFactory",
  494. "getInternalFrameMaximizeIcon",
  495. internalFrameIconArgs),
  496. "InternalFrame.iconifyIcon",
  497. new UIDefaults.ProxyLazyValue(
  498. "javax.swing.plaf.metal.MetalIconFactory",
  499. "getInternalFrameMinimizeIcon",
  500. internalFrameIconArgs),
  501. "InternalFrame.minimizeIcon",
  502. new UIDefaults.ProxyLazyValue(
  503. "javax.swing.plaf.metal.MetalIconFactory",
  504. "getInternalFrameAltMaximizeIcon",
  505. internalFrameIconArgs),
  506. "InternalFrame.font", new UIDefaults.ProxyLazyValue(
  507. "javax.swing.plaf.metal.MetalLookAndFeel",
  508. "getWindowTitleFont"),
  509. "InternalFrame.windowBindings", new Object[] {
  510. "shift ESCAPE", "showSystemMenu",
  511. "ctrl SPACE", "showSystemMenu",
  512. "ESCAPE", "hideSystemMenu"},
  513. // Desktop Icon
  514. "DesktopIcon.border", desktopIconBorder,
  515. "DesktopIcon.font", new UIDefaults.ProxyLazyValue(
  516. "javax.swing.plaf.metal.MetalLookAndFeel",
  517. "getControlTextFont"),
  518. "DesktopIcon.foreground", getControlTextColor(),
  519. "DesktopIcon.background", getControl(),
  520. "Desktop.ancestorInputMap",
  521. new UIDefaults.LazyInputMap(new Object[] {
  522. "ctrl F5", "restore",
  523. "ctrl F4", "close",
  524. "ctrl F7", "move",
  525. "ctrl F8", "resize",
  526. "RIGHT", "right",
  527. "KP_RIGHT", "right",
  528. "LEFT", "left",
  529. "KP_LEFT", "left",
  530. "UP", "up",
  531. "KP_UP", "up",
  532. "DOWN", "down",
  533. "KP_DOWN", "down",
  534. "ESCAPE", "escape",
  535. "ctrl F9", "minimize",
  536. "ctrl F10", "maximize",
  537. "ctrl F6", "selectNextFrame",
  538. "ctrl TAB", "selectNextFrame",
  539. "ctrl alt F6", "selectNextFrame",
  540. "shift ctrl alt F6", "selectPreviousFrame"
  541. }),
  542. // Titled Border
  543. "TitledBorder.font", new UIDefaults.ProxyLazyValue(
  544. "javax.swing.plaf.metal.MetalLookAndFeel",
  545. "getControlTextFont"),
  546. "TitledBorder.titleColor", getSystemTextColor(),
  547. "TitledBorder.border", titledBorderBorder,
  548. // Label
  549. "Label.font", new UIDefaults.ProxyLazyValue(
  550. "javax.swing.plaf.metal.MetalLookAndFeel",
  551. "getControlTextFont"),
  552. "Label.background", table.get("control"),
  553. "Label.foreground", getSystemTextColor(),
  554. "Label.disabledForeground", getInactiveSystemTextColor(),
  555. // List
  556. "List.focusCellHighlightBorder", focusCellHighlightBorder,
  557. "List.focusInputMap",
  558. new UIDefaults.LazyInputMap(new Object[] {
  559. "UP", "selectPreviousRow",
  560. "KP_UP", "selectPreviousRow",
  561. "shift UP", "selectPreviousRowExtendSelection",
  562. "shift KP_UP", "selectPreviousRowExtendSelection",
  563. "DOWN", "selectNextRow",
  564. "KP_DOWN", "selectNextRow",
  565. "shift DOWN", "selectNextRowExtendSelection",
  566. "shift KP_DOWN", "selectNextRowExtendSelection",
  567. "HOME", "selectFirstRow",
  568. "shift HOME", "selectFirstRowExtendSelection",
  569. "END", "selectLastRow",
  570. "shift END", "selectLastRowExtendSelection",
  571. "PAGE_UP", "scrollUp",
  572. "shift PAGE_UP", "scrollUpExtendSelection",
  573. "PAGE_DOWN", "scrollDown",
  574. "shift PAGE_DOWN", "scrollDownExtendSelection",
  575. "ctrl A", "selectAll",
  576. "ctrl SLASH", "selectAll",
  577. "ctrl BACK_SLASH", "clearSelection"
  578. }),
  579. // ScrollBar
  580. "ScrollBar.background", getControl(),
  581. "ScrollBar.highlight", getControlHighlight(),
  582. "ScrollBar.shadow", getControlShadow(),
  583. "ScrollBar.darkShadow", getControlDarkShadow(),
  584. "ScrollBar.thumb", getPrimaryControlShadow(),
  585. "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
  586. "ScrollBar.thumbHighlight", getPrimaryControl(),
  587. "ScrollBar.width", new Integer( 17 ),
  588. "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
  589. "ScrollBar.focusInputMap",
  590. new UIDefaults.LazyInputMap(new Object[] {
  591. "RIGHT", "negativeUnitIncrement",
  592. "KP_RIGHT", "negativeUnitIncrement",
  593. "DOWN", "positiveUnitIncrement",
  594. "KP_DOWN", "positiveUnitIncrement",
  595. "PAGE_DOWN", "positiveBlockIncrement",
  596. "LEFT", "positiveUnitIncrement",
  597. "KP_LEFT", "positiveUnitIncrement",
  598. "UP", "negativeUnitIncrement",
  599. "KP_UP", "negativeUnitIncrement",
  600. "PAGE_UP", "negativeBlockIncrement",
  601. "HOME", "minScroll",
  602. "END", "maxScroll"
  603. }),
  604. // ScrollPane
  605. "ScrollPane.border", scrollPaneBorder,
  606. "ScrollPane.background", table.get("control"/*"window"*/),
  607. "ScrollPane.ancestorInputMap",
  608. new UIDefaults.LazyInputMap(new Object[] {
  609. "RIGHT", "unitScrollRight",
  610. "KP_RIGHT", "unitScrollRight",
  611. "DOWN", "unitScrollDown",
  612. "KP_DOWN", "unitScrollDown",
  613. "LEFT", "unitScrollLeft",
  614. "KP_LEFT", "unitScrollLeft",
  615. "UP", "unitScrollUp",
  616. "KP_UP", "unitScrollUp",
  617. "PAGE_UP", "scrollUp",
  618. "PAGE_DOWN", "scrollDown",
  619. "ctrl PAGE_UP", "scrollLeft",
  620. "ctrl PAGE_DOWN", "scrollRight",
  621. "ctrl HOME", "scrollHome",
  622. "ctrl END", "scrollEnd"
  623. }),
  624. // Tabbed Pane
  625. "TabbedPane.font", new UIDefaults.ProxyLazyValue(
  626. "javax.swing.plaf.metal.MetalLookAndFeel",
  627. "getControlTextFont"),
  628. "TabbedPane.tabAreaBackground", getControl(),
  629. "TabbedPane.background", getControlShadow(),
  630. "TabbedPane.foreground", getControlTextColor(),
  631. "TabbedPane.highlight", getControl(),
  632. "TabbedPane.lightHighlight", getControlHighlight(),
  633. "TabbedPane.darkShadow", getControlDarkShadow(),
  634. "TabbedPane.focus", getPrimaryControlDarkShadow(),
  635. "TabbedPane.selected", getControl(),
  636. "TabbedPane.selectHighlight", getControlHighlight(),
  637. "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
  638. "TabbedPane.focusInputMap",
  639. new UIDefaults.LazyInputMap(new Object[] {
  640. "RIGHT", "navigateRight",
  641. "KP_RIGHT", "navigateRight",
  642. "LEFT", "navigateLeft",
  643. "KP_LEFT", "navigateLeft",
  644. "UP", "navigateUp",
  645. "KP_UP", "navigateUp",
  646. "DOWN", "navigateDown",
  647. "KP_DOWN", "navigateDown",
  648. "ctrl DOWN", "requestFocusForVisibleComponent",
  649. "ctrl KP_DOWN", "requestFocusForVisibleComponent",
  650. }),
  651. "TabbedPane.ancestorInputMap",
  652. new UIDefaults.LazyInputMap(new Object[] {
  653. "ctrl PAGE_DOWN", "navigatePageDown",
  654. "ctrl PAGE_UP", "navigatePageUp",
  655. "ctrl UP", "requestFocus",
  656. "ctrl KP_UP", "requestFocus",
  657. }),
  658. // Table
  659. "Table.font", new UIDefaults.ProxyLazyValue(
  660. "javax.swing.plaf.metal.MetalLookAndFeel",
  661. "getUserTextFont"),
  662. "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  663. "Table.focusCellBackground", table.get("window"),
  664. "Table.scrollPaneBorder", scrollPaneBorder,
  665. "Table.gridColor", getControlShadow(), // grid line color
  666. "Table.ancestorInputMap",
  667. new UIDefaults.LazyInputMap(new Object[] {
  668. "RIGHT", "selectNextColumn",
  669. "KP_RIGHT", "selectNextColumn",
  670. "LEFT", "selectPreviousColumn",
  671. "KP_LEFT", "selectPreviousColumn",
  672. "DOWN", "selectNextRow",
  673. "KP_DOWN", "selectNextRow",
  674. "UP", "selectPreviousRow",
  675. "KP_UP", "selectPreviousRow",
  676. "shift RIGHT", "selectNextColumnExtendSelection",
  677. "shift KP_RIGHT", "selectNextColumnExtendSelection",
  678. "shift LEFT", "selectPreviousColumnExtendSelection",
  679. "shift KP_LEFT", "selectPreviousColumnExtendSelection",
  680. "shift DOWN", "selectNextRowExtendSelection",
  681. "shift KP_DOWN", "selectNextRowExtendSelection",
  682. "shift UP", "selectPreviousRowExtendSelection",
  683. "shift KP_UP", "selectPreviousRowExtendSelection",
  684. "PAGE_UP", "scrollUpChangeSelection",
  685. "PAGE_DOWN", "scrollDownChangeSelection",
  686. "HOME", "selectFirstColumn",
  687. "END", "selectLastColumn",
  688. "shift PAGE_UP", "scrollUpExtendSelection",
  689. "shift PAGE_DOWN", "scrollDownExtendSelection",
  690. "shift HOME", "selectFirstColumnExtendSelection",
  691. "shift END", "selectLastColumnExtendSelection",
  692. "ctrl PAGE_UP", "scrollLeftChangeSelection",
  693. "ctrl PAGE_DOWN", "scrollRightChangeSelection",
  694. "ctrl HOME", "selectFirstRow",
  695. "ctrl END", "selectLastRow",
  696. "ctrl shift PAGE_UP", "scrollRightExtendSelection",
  697. "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
  698. "ctrl shift HOME", "selectFirstRowExtendSelection",
  699. "ctrl shift END", "selectLastRowExtendSelection",
  700. "TAB", "selectNextColumnCell",
  701. "shift TAB", "selectPreviousColumnCell",
  702. "ENTER", "selectNextRowCell",
  703. "shift ENTER", "selectPreviousRowCell",
  704. "ctrl A", "selectAll",
  705. "ESCAPE", "cancel",
  706. "F2", "startEditing"
  707. }),
  708. "TableHeader.font", new UIDefaults.ProxyLazyValue(
  709. "javax.swing.plaf.metal.MetalLookAndFeel",
  710. "getUserTextFont"),
  711. "TableHeader.cellBorder", new UIDefaults.ProxyLazyValue(
  712. "javax.swing.plaf.metal.MetalBorders$TableHeaderBorder"),
  713. // MenuBar
  714. "MenuBar.border", menuBarBorder,
  715. "MenuBar.font", new UIDefaults.ProxyLazyValue(
  716. "javax.swing.plaf.metal.MetalLookAndFeel",
  717. "getMenuTextFont"),
  718. "MenuBar.foreground", getMenuForeground(),
  719. "MenuBar.background", getMenuBackground(),
  720. "MenuBar.windowBindings", new Object[] {
  721. "F10", "takeFocus" },
  722. // Menu
  723. "Menu.border", menuItemBorder,
  724. "Menu.borderPainted", Boolean.TRUE,
  725. "Menu.font", new UIDefaults.ProxyLazyValue(
  726. "javax.swing.plaf.metal.MetalLookAndFeel",
  727. "getMenuTextFont"),
  728. "Menu.foreground", getMenuForeground(),
  729. "Menu.background", getMenuBackground(),
  730. "Menu.selectionForeground", getMenuSelectedForeground(),
  731. "Menu.selectionBackground", getMenuSelectedBackground(),
  732. "Menu.disabledForeground", getMenuDisabledForeground(),
  733. "Menu.acceleratorFont", new UIDefaults.ProxyLazyValue(
  734. "javax.swing.plaf.metal.MetalLookAndFeel",
  735. "getSubTextFont"),
  736. "Menu.acceleratorForeground", getAcceleratorForeground(),
  737. "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
  738. "Menu.checkIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemCheckIcon"),
  739. "Menu.arrowIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuArrowIcon"),
  740. // These window InputMap bindings are used when the Menu is
  741. // selected.
  742. "Menu.selectedWindowInputMapBindings", new Object[] {
  743. "ESCAPE", "cancel",
  744. "DOWN", "selectNext",
  745. "KP_DOWN", "selectNext",
  746. "UP", "selectPrevious",
  747. "KP_UP", "selectPrevious",
  748. "LEFT", "selectParent",
  749. "KP_LEFT", "selectParent",
  750. "RIGHT", "selectChild",
  751. "KP_RIGHT", "selectChild",
  752. "ENTER", "return",
  753. "SPACE", "return"
  754. },
  755. // Menu Item
  756. "MenuItem.border", menuItemBorder,
  757. "MenuItem.borderPainted", Boolean.TRUE,
  758. "MenuItem.font", new UIDefaults.ProxyLazyValue(
  759. "javax.swing.plaf.metal.MetalLookAndFeel",
  760. "getMenuTextFont"),
  761. "MenuItem.foreground", getMenuForeground(),
  762. "MenuItem.background", getMenuBackground(),
  763. "MenuItem.selectionForeground", getMenuSelectedForeground(),
  764. "MenuItem.selectionBackground", getMenuSelectedBackground(),
  765. "MenuItem.disabledForeground", getMenuDisabledForeground(),
  766. "MenuItem.acceleratorFont", new UIDefaults.ProxyLazyValue(
  767. "javax.swing.plaf.metal.MetalLookAndFeel",
  768. "getSubTextFont"),
  769. "MenuItem.acceleratorForeground", getAcceleratorForeground(),
  770. "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
  771. "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
  772. "MenuItem.checkIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemCheckIcon"),
  773. "MenuItem.arrowIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"),
  774. // OptionPane.
  775. "OptionPane.windowBindings", new Object[] {
  776. "ESCAPE", "close" },
  777. // Separator
  778. "Separator.background", getSeparatorBackground(),
  779. "Separator.foreground", getSeparatorForeground(),
  780. // Popup Menu
  781. "PopupMenu.background", getMenuBackground(),
  782. "PopupMenu.border", popupMenuBorder,
  783. // CB & RB Menu Item
  784. "CheckBoxMenuItem.border", menuItemBorder,
  785. "CheckBoxMenuItem.borderPainted", Boolean.TRUE,
  786. "CheckBoxMenuItem.font", new UIDefaults.ProxyLazyValue(
  787. "javax.swing.plaf.metal.MetalLookAndFeel",
  788. "getMenuTextFont"),
  789. "CheckBoxMenuItem.foreground", getMenuForeground(),
  790. "CheckBoxMenuItem.background", getMenuBackground(),
  791. "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
  792. "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
  793. "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
  794. "CheckBoxMenuItem.acceleratorFont", new UIDefaults.ProxyLazyValue(
  795. "javax.swing.plaf.metal.MetalLookAndFeel",
  796. "getSubTextFont"),
  797. "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
  798. "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
  799. "CheckBoxMenuItem.checkIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getCheckBoxMenuItemIcon"),
  800. "CheckBoxMenuItem.arrowIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"),
  801. "RadioButtonMenuItem.border", menuItemBorder,
  802. "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
  803. "RadioButtonMenuItem.font", new UIDefaults.ProxyLazyValue(
  804. "javax.swing.plaf.metal.MetalLookAndFeel",
  805. "getMenuTextFont"),
  806. "RadioButtonMenuItem.foreground", getMenuForeground(),
  807. "RadioButtonMenuItem.background", getMenuBackground(),
  808. "RadioButtonMenuItem.selectionForeground", getMenuSelectedForeground(),
  809. "RadioButtonMenuItem.selectionBackground", getMenuSelectedBackground(),
  810. "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
  811. "RadioButtonMenuItem.acceleratorFont", new UIDefaults.ProxyLazyValue(
  812. "javax.swing.plaf.metal.MetalLookAndFeel",
  813. "getSubTextFont"),
  814. "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
  815. "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
  816. "RadioButtonMenuItem.checkIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonMenuItemIcon"),
  817. "RadioButtonMenuItem.arrowIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"),
  818. // SplitPane
  819. "SplitPane.dividerSize", new Integer(10),
  820. "SplitPane.ancestorInputMap",
  821. new UIDefaults.LazyInputMap(new Object[] {
  822. "UP", "negativeIncrement",
  823. "DOWN", "positiveIncrement",
  824. "LEFT", "negativeIncrement",
  825. "RIGHT", "positiveIncrement",
  826. "KP_UP", "negativeIncrement",
  827. "KP_DOWN", "positiveIncrement",
  828. "KP_LEFT", "negativeIncrement",
  829. "KP_RIGHT", "positiveIncrement",
  830. "HOME", "selectMin",
  831. "END", "selectMax",
  832. "F8", "startResize",
  833. "F6", "toggleFocus"
  834. }),
  835. // Tree
  836. "Tree.background", getWindowBackground(),
  837. "Tree.font", new UIDefaults.ProxyLazyValue(
  838. "javax.swing.plaf.metal.MetalLookAndFeel",
  839. "getSystemTextFont"),
  840. "Tree.textForeground", table.get("textText"),
  841. "Tree.textBackground", getWindowBackground(),
  842. "Tree.selectionForeground", table.get("textHighlightText"),
  843. "Tree.selectionBackground", table.get("textHighlight"),
  844. "Tree.selectionBorderColor", MetalLookAndFeel.getFocusColor(),
  845. "Tree.openIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"),
  846. "Tree.closedIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"),
  847. "Tree.leafIcon", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeLeafIcon"),
  848. "Tree.expandedIcon", new UIDefaults.ProxyLazyValue(
  849. "javax.swing.plaf.metal.MetalIconFactory",
  850. "getTreeControlIcon",
  851. new Object[] {new Boolean(MetalIconFactory.DARK)}),
  852. "Tree.collapsedIcon", new UIDefaults.ProxyLazyValue(
  853. "javax.swing.plaf.metal.MetalIconFactory",
  854. "getTreeControlIcon",
  855. new Object[] {new Boolean( MetalIconFactory.LIGHT )}),
  856. "Tree.line", getPrimaryControl(), // horiz lines
  857. "Tree.hash", getPrimaryControl(), // legs
  858. "Tree.rowHeight", new Integer(0),
  859. "Tree.focusInputMap",
  860. new UIDefaults.LazyInputMap(new Object[] {
  861. "UP", "selectPrevious",
  862. "KP_UP", "selectPrevious",
  863. "shift UP", "selectPreviousExtendSelection",
  864. "shift KP_UP", "selectPreviousExtendSelection",
  865. "DOWN", "selectNext",
  866. "KP_DOWN", "selectNext",
  867. "shift DOWN", "selectNextExtendSelection",
  868. "shift KP_DOWN", "selectNextExtendSelection",
  869. "RIGHT", "selectChild",
  870. "KP_RIGHT", "selectChild",
  871. "LEFT", "selectParent",
  872. "KP_LEFT", "selectParent",
  873. "PAGE_UP", "scrollUpChangeSelection",
  874. "shift PAGE_UP", "scrollUpExtendSelection",
  875. "PAGE_DOWN", "scrollDownChangeSelection",
  876. "shift PAGE_DOWN", "scrollDownExtendSelection",
  877. "HOME", "selectFirst",
  878. "shift HOME", "selectFirstExtendSelection",
  879. "END", "selectLast",
  880. "shift END", "selectLastExtendSelection",
  881. "ENTER", "toggle",
  882. "F2", "startEditing",
  883. "ctrl A", "selectAll",
  884. "ctrl SLASH", "selectAll",
  885. "ctrl BACK_SLASH", "clearSelection",
  886. "ctrl SPACE", "toggleSelectionPreserveAnchor",
  887. "shift SPACE", "extendSelection",
  888. "ctrl HOME", "selectFirstChangeLead",
  889. "ctrl END", "selectLastChangeLead",
  890. "ctrl UP", "selectPreviousChangeLead",
  891. "ctrl KP_UP", "selectPreviousChangeLead",
  892. "ctrl DOWN", "selectNextChangeLead",
  893. "ctrl KP_DOWN", "selectNextChangeLead",
  894. "ctrl PAGE_DOWN", "scrollDownChangeLead",
  895. "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
  896. "ctrl PAGE_UP", "scrollUpChangeLead",
  897. "ctrl shift PAGE_UP", "scrollUpExtendSelection",
  898. "ctrl LEFT", "scrollLeft",
  899. "ctrl KP_LEFT", "scrollLeft",
  900. "ctrl RIGHT", "scrollRight",
  901. "ctrl KP_RIGHT", "scrollRight",
  902. "SPACE", "toggleSelectionPreserveAnchor",
  903. }),
  904. "Tree.ancestorInputMap",
  905. new UIDefaults.LazyInputMap(new Object[] {
  906. "ESCAPE", "cancel"
  907. }),
  908. // ToolBar
  909. "ToolBar.border", toolBarBorder,
  910. "ToolBar.background", getMenuBackground(),
  911. "ToolBar.foreground", getMenuForeground(),
  912. "ToolBar.font", new UIDefaults.ProxyLazyValue(
  913. "javax.swing.plaf.metal.MetalLookAndFeel",
  914. "getMenuTextFont"),
  915. "ToolBar.dockingBackground", getMenuBackground(),
  916. "ToolBar.floatingBackground", getMenuBackground(),
  917. "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
  918. "ToolBar.floatingForeground", getPrimaryControl(),
  919. "ToolBar.ancestorInputMap",
  920. new UIDefaults.LazyInputMap(new Object[] {
  921. "UP", "navigateUp",
  922. "KP_UP", "navigateUp",
  923. "DOWN", "navigateDown",
  924. "KP_DOWN", "navigateDown",
  925. "LEFT", "navigateLeft",
  926. "KP_LEFT", "navigateLeft",
  927. "RIGHT", "navigateRight",
  928. "KP_RIGHT", "navigateRight"
  929. }),
  930. // These bindings are only enabled when there is a default
  931. // button set on the rootpane.
  932. "RootPane.defaultButtonWindowKeyBindings", new Object[] {
  933. "ENTER", "press",
  934. "released ENTER", "release",
  935. "ctrl ENTER", "press",
  936. "ctrl released ENTER", "release"
  937. },
  938. };
  939. table.putDefaults(defaults);
  940. }
  941. protected void createDefaultTheme() {
  942. if( getCurrentTheme() == null) {
  943. setCurrentTheme( new DefaultMetalTheme() );
  944. }
  945. }
  946. public UIDefaults getDefaults() {
  947. createDefaultTheme();
  948. UIDefaults table = super.getDefaults();
  949. currentTheme.addCustomEntriesToTable(table);
  950. return table;
  951. }
  952. public static void setCurrentTheme(MetalTheme theme) {
  953. if (theme == null) {
  954. throw new NullPointerException("Can't have null theme");
  955. }
  956. currentTheme = theme;
  957. cachedAppContext = sun.awt.AppContext.getAppContext();
  958. cachedAppContext.put( "currentMetalTheme", theme );
  959. }
  960. private static MetalTheme getCurrentTheme() {
  961. sun.awt.AppContext context = sun.awt.AppContext.getAppContext();
  962. if ( cachedAppContext != context ) {
  963. currentTheme = (MetalTheme)context.get( "currentMetalTheme" );
  964. cachedAppContext = context;
  965. }
  966. return currentTheme;
  967. }
  968. public static FontUIResource getControlTextFont() { return getCurrentTheme().getControlTextFont();}
  969. public static FontUIResource getSystemTextFont() { return getCurrentTheme().getSystemTextFont();}
  970. public static FontUIResource getUserTextFont() { return getCurrentTheme().getUserTextFont();}
  971. public static FontUIResource getMenuTextFont() { return getCurrentTheme().getMenuTextFont();}
  972. public static FontUIResource getWindowTitleFont() { return getCurrentTheme().getWindowTitleFont();}
  973. public static FontUIResource getSubTextFont() { return getCurrentTheme().getSubTextFont();}
  974. public static ColorUIResource getDesktopColor() { return getCurrentTheme().getDesktopColor(); }
  975. public static ColorUIResource getFocusColor() { return getCurrentTheme().getFocusColor(); }
  976. public static ColorUIResource getWhite() { return getCurrentTheme().getWhite(); }
  977. public static ColorUIResource getBlack() { return getCurrentTheme().getBlack(); }
  978. public static ColorUIResource getControl() { return getCurrentTheme().getControl(); }
  979. public static ColorUIResource getControlShadow() { return getCurrentTheme().getControlShadow(); }
  980. public static ColorUIResource getControlDarkShadow() { return getCurrentTheme().getControlDarkShadow(); }
  981. public static ColorUIResource getControlInfo() { return getCurrentTheme().getControlInfo(); }
  982. public static ColorUIResource getControlHighlight() { return getCurrentTheme().getControlHighlight(); }
  983. public static ColorUIResource getControlDisabled() { return getCurrentTheme().getControlDisabled(); }
  984. public static ColorUIResource getPrimaryControl() { return getCurrentTheme().getPrimaryControl(); }
  985. public static ColorUIResource getPrimaryControlShadow() { return getCurrentTheme().getPrimaryControlShadow(); }
  986. public static ColorUIResource getPrimaryControlDarkShadow() { return getCurrentTheme().getPrimaryControlDarkShadow(); }
  987. public static ColorUIResource getPrimaryControlInfo() { return getCurrentTheme().getPrimaryControlInfo(); }
  988. public static ColorUIResource getPrimaryControlHighlight() { return getCurrentTheme().getPrimaryControlHighlight(); }
  989. public static ColorUIResource getSystemTextColor() { return getCurrentTheme().getSystemTextColor(); }
  990. public static ColorUIResource getControlTextColor() { return getCurrentTheme().getControlTextColor(); }
  991. public static ColorUIResource getInactiveControlTextColor() { return getCurrentTheme().getInactiveControlTextColor(); }
  992. public static ColorUIResource getInactiveSystemTextColor() { return getCurrentTheme().getInactiveSystemTextColor(); }
  993. public static ColorUIResource getUserTextColor() { return getCurrentTheme().getUserTextColor(); }
  994. public static ColorUIResource getTextHighlightColor() { return getCurrentTheme().getTextHighlightColor(); }
  995. public static ColorUIResource getHighlightedTextColor() { return getCurrentTheme().getHighlightedTextColor(); }
  996. public static ColorUIResource getWindowBackground() { return getCurrentTheme().getWindowBackground(); }
  997. public static ColorUIResource getWindowTitleBackground() { return getCurrentTheme().getWindowTitleBackground(); }
  998. public static ColorUIResource getWindowTitleForeground() { return getCurrentTheme().getWindowTitleForeground(); }
  999. public static ColorUIResource getWindowTitleInactiveBackground() { return getCurrentTheme().getWindowTitleInactiveBackground(); }
  1000. public static ColorUIResource getWindowTitleInactiveForeground() { return getCurrentTheme().getWindowTitleInactiveForeground(); }
  1001. public static ColorUIResource getMenuBackground() { return getCurrentTheme().getMenuBackground(); }
  1002. public static ColorUIResource getMenuForeground() { return getCurrentTheme().getMenuForeground(); }
  1003. public static ColorUIResource getMenuSelectedBackground() { return getCurrentTheme().getMenuSelectedBackground(); }
  1004. public static ColorUIResource getMenuSelectedForeground() { return getCurrentTheme().getMenuSelectedForeground(); }
  1005. public static ColorUIResource getMenuDisabledForeground() { return getCurrentTheme().getMenuDisabledForeground(); }
  1006. public static ColorUIResource getSeparatorBackground() { return getCurrentTheme().getSeparatorBackground(); }
  1007. public static ColorUIResource getSeparatorForeground() { return getCurrentTheme().getSeparatorForeground(); }
  1008. public static ColorUIResource getAcceleratorForeground() { return getCurrentTheme().getAcceleratorForeground(); }
  1009. public static ColorUIResource getAcceleratorSelectedForeground() { return getCurrentTheme().getAcceleratorSelectedForeground(); }
  1010. }