1. /*
  2. * @(#)MotifLookAndFeel.java 1.158 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.java.swing.plaf.motif;
  8. import java.awt.Toolkit;
  9. import java.awt.Color;
  10. import java.awt.Font;
  11. import java.awt.Insets;
  12. import java.awt.event.KeyEvent;
  13. import java.awt.event.InputEvent;
  14. import java.util.*;
  15. import java.lang.reflect.*;
  16. import javax.swing.*;
  17. import javax.swing.plaf.*;
  18. import javax.swing.border.*;
  19. import javax.swing.text.JTextComponent;
  20. import javax.swing.text.DefaultEditorKit;
  21. import javax.swing.plaf.basic.BasicLookAndFeel;
  22. import javax.swing.plaf.basic.BasicBorders;
  23. import javax.swing.plaf.basic.BasicComboBoxRenderer;
  24. import javax.swing.plaf.basic.BasicComboBoxEditor;
  25. /**
  26. * Implements the Motif Look and Feel.
  27. * UI classes not implemented specifically for Motif will
  28. * default to those implemented in Basic.
  29. * <p>
  30. * For the keyboard keys defined for each component in this Look and
  31. * Feel (L&F), see
  32. * <a href="../../../../../../javax/swing/doc-files/Key-Motif.html">Component Keystroke Actions for the Motif L&F</a>.
  33. * <p>
  34. * <strong>Warning:</strong>
  35. * Serialized objects of this class will not be compatible with
  36. * future Swing releases. The current serialization support is appropriate
  37. * for short term storage or RMI between applications running the same
  38. * version of Swing. A future release of Swing will provide support for
  39. * long term persistence.
  40. *
  41. * @version 1.158 01/23/03
  42. * @author unattributed
  43. */
  44. public class MotifLookAndFeel extends BasicLookAndFeel
  45. {
  46. public String getName() {
  47. return "CDE/Motif";
  48. }
  49. public String getID() {
  50. return "Motif";
  51. }
  52. public String getDescription() {
  53. return "The CDE/Motif Look and Feel";
  54. }
  55. public boolean isNativeLookAndFeel() {
  56. String osName = System.getProperty("os.name");
  57. return (osName != null) &&
  58. (osName.indexOf("SunOS") != -1 || osName.indexOf("Solaris") != -1);
  59. }
  60. public boolean isSupportedLookAndFeel() {
  61. return true;
  62. }
  63. /**
  64. * Load the SystemColors into the defaults table. The keys
  65. * for SystemColor defaults are the same as the names of
  66. * the public fields in SystemColor. If the table is being
  67. * created on a native Motif platform we use the SystemColor
  68. * values, otherwise we create color objects whose values match
  69. * the default CDE/Motif colors.
  70. */
  71. protected void initSystemColorDefaults(UIDefaults table)
  72. {
  73. String[] defaultSystemColors = {
  74. "desktop", "#005C5C", /* Color of the desktop background */
  75. "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
  76. "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
  77. "activeCaptionBorder", "#B24D7A", /* Border color for caption (title bar) window borders. */
  78. "inactiveCaption", "#AEB2C3", /* Color for captions (title bars) when not active. */
  79. "inactiveCaptionText", "#000000", /* Text color for text in inactive captions (title bars). */
  80. "inactiveCaptionBorder", "#AEB2C3", /* Border color for inactive caption (title bar) window borders. */
  81. "window", "#AEB2C3", /* Default color for the interior of windows */
  82. "windowBorder", "#AEB2C3", /* ??? */
  83. "windowText", "#000000", /* ??? */
  84. "menu", "#AEB2C3", /* ??? */
  85. "menuText", "#000000", /* ??? */
  86. "text", "#FFF7E9", /* Text background color */
  87. "textText", "#000000", /* Text foreground color */
  88. "textHighlight", "#000000", /* Text background color when selected */
  89. "textHighlightText", "#FFF7E9", /* Text color when selected */
  90. "textInactiveText", "#808080", /* Text color when disabled */
  91. "control", "#AEB2C3", /* Default color for controls (buttons, sliders, etc) */
  92. "controlText", "#000000", /* Default color for text in controls */
  93. "controlHighlight", "#DCDEE5", /* Highlight color for controls */
  94. "controlLtHighlight", "#DCDEE5", /* Light highlight color for controls */
  95. "controlShadow", "#63656F", /* Shadow color for controls */
  96. "controlLightShadow", "#9397A5", /* Shadow color for controls */
  97. "controlDkShadow", "#000000", /* Dark shadow color for controls */
  98. "scrollbar", "#AEB2C3", /* Scrollbar ??? color. PENDING(jeff) foreground? background? ?*/
  99. "info", "#FFF7E9", /* ??? */
  100. "infoText", "#000000" /* ??? */
  101. };
  102. // AWT SystemColors only for for CDE on JDK1.2
  103. loadSystemColors(table, defaultSystemColors, false/*is1dot2*/);
  104. }
  105. protected void initClassDefaults(UIDefaults table)
  106. {
  107. super.initClassDefaults(table);
  108. String motifPackageName = "com.sun.java.swing.plaf.motif.";
  109. Object[] uiDefaults = {
  110. "ButtonUI", motifPackageName + "MotifButtonUI",
  111. "CheckBoxUI", motifPackageName + "MotifCheckBoxUI",
  112. "DirectoryPaneUI", motifPackageName + "MotifDirectoryPaneUI",
  113. "FileChooserUI", motifPackageName + "MotifFileChooserUI",
  114. "LabelUI", motifPackageName + "MotifLabelUI",
  115. "MenuBarUI", motifPackageName + "MotifMenuBarUI",
  116. "MenuUI", motifPackageName + "MotifMenuUI",
  117. "MenuItemUI", motifPackageName + "MotifMenuItemUI",
  118. "CheckBoxMenuItemUI", motifPackageName + "MotifCheckBoxMenuItemUI",
  119. "RadioButtonMenuItemUI", motifPackageName + "MotifRadioButtonMenuItemUI",
  120. "RadioButtonUI", motifPackageName + "MotifRadioButtonUI",
  121. "ToggleButtonUI", motifPackageName + "MotifToggleButtonUI",
  122. "PopupMenuUI", motifPackageName + "MotifPopupMenuUI",
  123. "ProgressBarUI", motifPackageName + "MotifProgressBarUI",
  124. "ScrollBarUI", motifPackageName + "MotifScrollBarUI",
  125. "ScrollPaneUI", motifPackageName + "MotifScrollPaneUI",
  126. "SliderUI", motifPackageName + "MotifSliderUI",
  127. "SplitPaneUI", motifPackageName + "MotifSplitPaneUI",
  128. "TabbedPaneUI", motifPackageName + "MotifTabbedPaneUI",
  129. "TextAreaUI", motifPackageName + "MotifTextAreaUI",
  130. "TextFieldUI", motifPackageName + "MotifTextFieldUI",
  131. "PasswordFieldUI", motifPackageName + "MotifPasswordFieldUI",
  132. "TextPaneUI", motifPackageName + "MotifTextPaneUI",
  133. "EditorPaneUI", motifPackageName + "MotifEditorPaneUI",
  134. "TreeUI", motifPackageName + "MotifTreeUI",
  135. "InternalFrameUI", motifPackageName + "MotifInternalFrameUI",
  136. "DesktopPaneUI", motifPackageName + "MotifDesktopPaneUI",
  137. "SeparatorUI", motifPackageName + "MotifSeparatorUI",
  138. "PopupMenuSeparatorUI", motifPackageName + "MotifPopupMenuSeparatorUI",
  139. "OptionPaneUI", motifPackageName + "MotifOptionPaneUI",
  140. "ComboBoxUI", motifPackageName + "MotifComboBoxUI",
  141. "DesktopIconUI", motifPackageName + "MotifDesktopIconUI"
  142. };
  143. table.putDefaults(uiDefaults);
  144. }
  145. /**
  146. * Initialize the defaults table with the name of the ResourceBundle
  147. * used for getting localized defaults.
  148. */
  149. private void initResourceBundle(UIDefaults table) {
  150. table.addResourceBundle( "com.sun.java.swing.plaf.motif.resources.motif" );
  151. }
  152. protected void initComponentDefaults(UIDefaults table)
  153. {
  154. super.initComponentDefaults(table);
  155. initResourceBundle(table);
  156. FontUIResource dialogPlain12 = new FontUIResource("Dialog",
  157. Font.PLAIN, 12);
  158. FontUIResource serifPlain12 = new FontUIResource("Serif",
  159. Font.PLAIN, 12);
  160. FontUIResource sansSerifPlain12 = new FontUIResource("SansSerif",
  161. Font.PLAIN, 12);
  162. FontUIResource monospacedPlain12 = new FontUIResource("Monospaced",
  163. Font.PLAIN, 12);
  164. ColorUIResource red = new ColorUIResource(Color.red);
  165. ColorUIResource black = new ColorUIResource(Color.black);
  166. ColorUIResource white = new ColorUIResource(Color.white);
  167. ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
  168. ColorUIResource controlDarker = new ColorUIResource(147, 151, 165); // slate blue
  169. ColorUIResource scrollBarTrack = controlDarker;
  170. ColorUIResource menuItemPressedBackground = new ColorUIResource(165,165,165);
  171. ColorUIResource menuItemPressedForeground = new ColorUIResource(0,0,0);
  172. Border loweredBevelBorder = new MotifBorders.BevelBorder(false,
  173. table.getColor("controlShadow"),
  174. table.getColor("controlLtHighlight"));
  175. Border raisedBevelBorder = new MotifBorders.BevelBorder(true, table.getColor("controlShadow"),
  176. table.getColor("controlLtHighlight"));
  177. Border marginBorder = new BasicBorders.MarginBorder();
  178. Border focusBorder = new MotifBorders.FocusBorder(
  179. table.getColor("control"),
  180. table.getColor("activeCaptionBorder"));
  181. Border focusBevelBorder = new BorderUIResource.CompoundBorderUIResource(
  182. focusBorder,
  183. loweredBevelBorder);
  184. Border comboBoxBorder = new BorderUIResource.CompoundBorderUIResource(
  185. focusBorder,
  186. raisedBevelBorder);
  187. Border buttonBorder = new BorderUIResource.CompoundBorderUIResource(
  188. new MotifBorders.ButtonBorder(
  189. table.getColor("Button.shadow"),
  190. table.getColor("Button.highlight"),
  191. table.getColor("Button.darkShadow"),
  192. table.getColor("activeCaptionBorder")),
  193. marginBorder);
  194. Border toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource(
  195. new MotifBorders.ToggleButtonBorder(
  196. table.getColor("ToggleButton.shadow"),
  197. table.getColor("ToggleButton.highlight"),
  198. table.getColor("ToggleButton.darkShadow"),
  199. table.getColor("activeCaptionBorder")), marginBorder);
  200. Border textFieldBorder = new BorderUIResource.CompoundBorderUIResource(
  201. focusBevelBorder,
  202. marginBorder);
  203. Border popupMenuBorder = new BorderUIResource.CompoundBorderUIResource(
  204. raisedBevelBorder,
  205. new MotifBorders.MotifPopupMenuBorder(
  206. table.getFont("PopupMenu.font"),
  207. table.getColor("PopupMenu.background"),
  208. table.getColor("PopupMenu.foreground"),
  209. table.getColor("controlShadow"),
  210. table.getColor("controlLtHighlight")
  211. ));
  212. Object menuItemCheckIcon = new UIDefaults.LazyValue() {
  213. public Object createValue(UIDefaults table) {
  214. return MotifIconFactory.getMenuItemCheckIcon();
  215. }
  216. };
  217. Object menuItemArrowIcon = new UIDefaults.LazyValue() {
  218. public Object createValue(UIDefaults table) {
  219. return MotifIconFactory.getMenuItemArrowIcon();
  220. }
  221. };
  222. Object menuArrowIcon = new UIDefaults.LazyValue() {
  223. public Object createValue(UIDefaults table) {
  224. return MotifIconFactory.getMenuArrowIcon();
  225. }
  226. };
  227. Object checkBoxIcon = new UIDefaults.LazyValue() {
  228. public Object createValue(UIDefaults table) {
  229. return MotifIconFactory.getCheckBoxIcon();
  230. }
  231. };
  232. Object radioButtonIcon = new UIDefaults.LazyValue() {
  233. public Object createValue(UIDefaults table) {
  234. return MotifIconFactory.getRadioButtonIcon();
  235. }
  236. };
  237. Object unselectedTabBackground = new UIDefaults.LazyValue() {
  238. public Object createValue(UIDefaults table) {
  239. Color c = (Color)table.getColor("control");
  240. return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
  241. Math.max((int)(c.getGreen()*.85),0),
  242. Math.max((int)(c.getBlue()*.85),0));
  243. }
  244. };
  245. Object unselectedTabForeground = new UIDefaults.LazyValue() {
  246. public Object createValue(UIDefaults table) {
  247. Color c = (Color)table.getColor("controlText");
  248. return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
  249. Math.max((int)(c.getGreen()*.85),0),
  250. Math.max((int)(c.getBlue()*.85),0));
  251. }
  252. };
  253. Object unselectedTabShadow = new UIDefaults.LazyValue() {
  254. public Object createValue(UIDefaults table) {
  255. Color c = (Color)table.getColor("control");
  256. Color base = new Color(Math.max((int)(c.getRed()*.85),0),
  257. Math.max((int)(c.getGreen()*.85),0),
  258. Math.max((int)(c.getBlue()*.85),0));
  259. return new ColorUIResource(base.darker());
  260. }
  261. };
  262. Object unselectedTabHighlight = new UIDefaults.LazyValue() {
  263. public Object createValue(UIDefaults table) {
  264. Color c = (Color)table.getColor("control");
  265. Color base = new Color(Math.max((int)(c.getRed()*.85),0),
  266. Math.max((int)(c.getGreen()*.85),0),
  267. Math.max((int)(c.getBlue()*.85),0));
  268. return new ColorUIResource(base.brighter());
  269. }
  270. };
  271. // *** Text
  272. Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
  273. "COPY", DefaultEditorKit.copyAction,
  274. "PASTE", DefaultEditorKit.pasteAction,
  275. "CUT", DefaultEditorKit.cutAction,
  276. "control INSERT", DefaultEditorKit.copyAction,
  277. "shift INSERT", DefaultEditorKit.pasteAction,
  278. "shift DELETE", DefaultEditorKit.cutAction,
  279. "control F", DefaultEditorKit.forwardAction,
  280. "control B", DefaultEditorKit.backwardAction,
  281. "control D", DefaultEditorKit.deleteNextCharAction,
  282. "typed \010", DefaultEditorKit.deletePrevCharAction,
  283. "DELETE", DefaultEditorKit.deleteNextCharAction,
  284. "RIGHT", DefaultEditorKit.forwardAction,
  285. "LEFT", DefaultEditorKit.backwardAction,
  286. "KP_RIGHT", DefaultEditorKit.forwardAction,
  287. "KP_LEFT", DefaultEditorKit.backwardAction,
  288. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  289. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  290. "control LEFT", DefaultEditorKit.previousWordAction,
  291. "control RIGHT", DefaultEditorKit.nextWordAction,
  292. "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  293. "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  294. "control SLASH", DefaultEditorKit.selectAllAction,
  295. "HOME", DefaultEditorKit.beginLineAction,
  296. "END", DefaultEditorKit.endLineAction,
  297. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  298. "shift END", DefaultEditorKit.selectionEndLineAction,
  299. "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
  300. "ENTER", JTextField.notifyAction,
  301. "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
  302. });
  303. Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
  304. "COPY", DefaultEditorKit.copyAction,
  305. "PASTE", DefaultEditorKit.pasteAction,
  306. "CUT", DefaultEditorKit.cutAction,
  307. "control INSERT", DefaultEditorKit.copyAction,
  308. "shift INSERT", DefaultEditorKit.pasteAction,
  309. "shift DELETE", DefaultEditorKit.cutAction,
  310. "control F", DefaultEditorKit.forwardAction,
  311. "control B", DefaultEditorKit.backwardAction,
  312. "control D", DefaultEditorKit.deleteNextCharAction,
  313. "typed \010", DefaultEditorKit.deletePrevCharAction,
  314. "DELETE", DefaultEditorKit.deleteNextCharAction,
  315. "RIGHT", DefaultEditorKit.forwardAction,
  316. "LEFT", DefaultEditorKit.backwardAction,
  317. "KP_RIGHT", DefaultEditorKit.forwardAction,
  318. "KP_LEFT", DefaultEditorKit.backwardAction,
  319. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  320. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  321. "control LEFT", DefaultEditorKit.previousWordAction,
  322. "control RIGHT", DefaultEditorKit.nextWordAction,
  323. "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  324. "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  325. "control SLASH", DefaultEditorKit.selectAllAction,
  326. "HOME", DefaultEditorKit.beginLineAction,
  327. "END", DefaultEditorKit.endLineAction,
  328. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  329. "shift END", DefaultEditorKit.selectionEndLineAction,
  330. "control N", DefaultEditorKit.downAction,
  331. "control P", DefaultEditorKit.upAction,
  332. "UP", DefaultEditorKit.upAction,
  333. "DOWN", DefaultEditorKit.downAction,
  334. "PAGE_UP", DefaultEditorKit.pageUpAction,
  335. "PAGE_DOWN", DefaultEditorKit.pageDownAction,
  336. "shift PAGE_UP", "selection-page-up",
  337. "shift PAGE_DOWN", "selection-page-down",
  338. "ctrl shift PAGE_UP", "selection-page-left",
  339. "ctrl shift PAGE_DOWN", "selection-page-right",
  340. "shift UP", DefaultEditorKit.selectionUpAction,
  341. "shift DOWN", DefaultEditorKit.selectionDownAction,
  342. "ENTER", DefaultEditorKit.insertBreakAction,
  343. "TAB", DefaultEditorKit.insertTabAction,
  344. "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
  345. "control HOME", DefaultEditorKit.beginAction,
  346. "control END", DefaultEditorKit.endAction,
  347. "control shift HOME", DefaultEditorKit.selectionBeginAction,
  348. "control shift END", DefaultEditorKit.selectionEndAction,
  349. "control T", "next-link-action",
  350. "control shift T", "previous-link-action",
  351. "control SPACE", "activate-link-action",
  352. "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
  353. });
  354. // *** Tree
  355. Object treeOpenIcon = LookAndFeel.makeIcon(getClass(),
  356. "icons/TreeOpen.gif");
  357. Object treeClosedIcon = LookAndFeel.makeIcon(getClass(),
  358. "icons/TreeClosed.gif");
  359. Object treeLeafIcon = new UIDefaults.LazyValue() {
  360. public Object createValue(UIDefaults table) {
  361. return MotifTreeCellRenderer.loadLeafIcon();
  362. }
  363. };
  364. Object treeExpandedIcon = new UIDefaults.LazyValue() {
  365. public Object createValue(UIDefaults table) {
  366. return MotifTreeUI.MotifExpandedIcon.createExpandedIcon();
  367. }
  368. };
  369. Object treeCollapsedIcon = new UIDefaults.LazyValue() {
  370. public Object createValue(UIDefaults table) {
  371. return MotifTreeUI.MotifCollapsedIcon.createCollapsedIcon();
  372. }
  373. };
  374. Border menuBarBorder = new MotifBorders.MenuBarBorder(
  375. table.getColor("MenuBar.shadow"),
  376. table.getColor("MenuBar.highlight"),
  377. table.getColor("MenuBar.darkShadow"),
  378. table.getColor("activeCaptionBorder"));
  379. Border menuMarginBorder = new BorderUIResource.CompoundBorderUIResource(
  380. loweredBevelBorder,
  381. marginBorder);
  382. Border focusCellHighlightBorder = new BorderUIResource.LineBorderUIResource(
  383. table.getColor("activeCaptionBorder"));
  384. Object sliderFocusInsets = new InsetsUIResource( 0, 0, 0, 0 );
  385. // ** for tabbedpane
  386. Object tabbedPaneTabInsets = new InsetsUIResource(3, 4, 3, 4);
  387. Object tabbedPaneTabPadInsets = new InsetsUIResource(3, 0, 1, 0);
  388. Object tabbedPaneTabAreaInsets = new InsetsUIResource(4, 2, 0, 8);
  389. Object tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 2, 2);
  390. // ** for optionpane
  391. Object optionPaneBorder = new BorderUIResource.EmptyBorderUIResource(10,0,0,0);
  392. Object optionPaneButtonAreaBorder = new BorderUIResource.EmptyBorderUIResource(10,10,10,10);
  393. Object optionPaneMessageAreaBorder = new BorderUIResource.EmptyBorderUIResource(10,10,12,10);
  394. Object[] defaults = {
  395. "Desktop.background", table.get("desktop"),
  396. "Desktop.ancestorInputMap",
  397. new UIDefaults.LazyInputMap(new Object[] {
  398. "ctrl F5", "restore",
  399. "ctrl F4", "close",
  400. "ctrl F7", "move",
  401. "ctrl F8", "resize",
  402. "RIGHT", "right",
  403. "KP_RIGHT", "right",
  404. "shift RIGHT", "shrinkRight",
  405. "shift KP_RIGHT", "shrinkRight",
  406. "LEFT", "left",
  407. "KP_LEFT", "left",
  408. "shift LEFT", "shrinkLeft",
  409. "shift KP_LEFT", "shrinkLeft",
  410. "UP", "up",
  411. "KP_UP", "up",
  412. "shift UP", "shrinkUp",
  413. "shift KP_UP", "shrinkUp",
  414. "DOWN", "down",
  415. "KP_DOWN", "down",
  416. "shift DOWN", "shrinkDown",
  417. "shift KP_DOWN", "shrinkDown",
  418. "ESCAPE", "escape",
  419. "ctrl F9", "minimize",
  420. "ctrl F10", "maximize",
  421. "ctrl F6", "selectNextFrame",
  422. "ctrl TAB", "selectNextFrame",
  423. "ctrl alt F6", "selectNextFrame",
  424. "shift ctrl alt F6", "selectPreviousFrame",
  425. "ctrl F12", "navigateNext",
  426. "shift ctrl F12", "navigatePrevious"
  427. }),
  428. "Panel.background", table.get("control"),
  429. "Panel.foreground", table.get("textText"),
  430. "Panel.font", dialogPlain12,
  431. "ProgressBar.font", dialogPlain12,
  432. "ProgressBar.foreground", controlDarker,
  433. "ProgressBar.background", table.get("control"),
  434. "ProgressBar.selectionForeground", table.get("control"),
  435. "ProgressBar.selectionBackground", table.get("controlText"),
  436. "ProgressBar.border", loweredBevelBorder,
  437. "ProgressBar.cellLength", new Integer(6),
  438. "ProgressBar.cellSpacing", new Integer(0),
  439. // Buttons
  440. "Button.margin", new InsetsUIResource(2, 4, 2, 4),
  441. "Button.border", buttonBorder,
  442. "Button.background", table.get("control"),
  443. "Button.foreground", table.get("controlText"),
  444. "Button.select", table.get("controlLightShadow"),
  445. "Button.font", dialogPlain12,
  446. "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
  447. "SPACE", "pressed",
  448. "released SPACE", "released"
  449. }),
  450. "CheckBox.textIconGap", new Integer(8),
  451. "CheckBox.margin", new InsetsUIResource(4, 2, 4, 2),
  452. "CheckBox.icon", checkBoxIcon,
  453. "CheckBox.focus", table.get("activeCaptionBorder"),
  454. "CheckBox.focusInputMap",
  455. new UIDefaults.LazyInputMap(new Object[] {
  456. "SPACE", "pressed",
  457. "released SPACE", "released"
  458. }),
  459. "RadioButton.margin", new InsetsUIResource(4, 2, 4, 2),
  460. "RadioButton.textIconGap", new Integer(8),
  461. "RadioButton.background", table.get("control"),
  462. "RadioButton.foreground", table.get("controlText"),
  463. "RadioButton.icon", radioButtonIcon,
  464. "RadioButton.focus", table.get("activeCaptionBorder"),
  465. "RadioButton.icon", radioButtonIcon,
  466. "RadioButton.focusInputMap",
  467. new UIDefaults.LazyInputMap(new Object[] {
  468. "SPACE", "pressed",
  469. "released SPACE", "released"
  470. }),
  471. "ToggleButton.border", toggleButtonBorder,
  472. "ToggleButton.background", table.get("control"),
  473. "ToggleButton.foreground", table.get("controlText"),
  474. "ToggleButton.focus", table.get("controlText"),
  475. "ToggleButton.select", table.get("controlLightShadow"),
  476. "ToggleButton.focusInputMap",
  477. new UIDefaults.LazyInputMap(new Object[] {
  478. "SPACE", "pressed",
  479. "released SPACE", "released"
  480. }),
  481. // Menus
  482. "Menu.border", menuMarginBorder,
  483. "Menu.font", dialogPlain12,
  484. "Menu.acceleratorFont", dialogPlain12,
  485. "Menu.foreground", table.get("menuText"),
  486. "Menu.background", table.get("menu"),
  487. "Menu.selectionForeground", menuItemPressedForeground,
  488. "Menu.selectionBackground", menuItemPressedBackground,
  489. "Menu.checkIcon", menuItemCheckIcon,
  490. "Menu.arrowIcon", menuArrowIcon,
  491. "Menu.menuPopupOffsetX", new Integer(0),
  492. "Menu.menuPopupOffsetY", new Integer(0),
  493. "Menu.submenuPopupOffsetX", new Integer(-2),
  494. "Menu.submenuPopupOffsetY", new Integer(3),
  495. "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK,
  496. KeyEvent.META_MASK},
  497. "MenuBar.border", menuBarBorder,
  498. "MenuBar.background", table.get("menu"),
  499. "MenuBar.foreground", table.get("menuText"),
  500. "MenuBar.font", dialogPlain12,
  501. "MenuBar.windowBindings", new Object[] {
  502. "F10", "takeFocus" },
  503. "MenuItem.border", menuMarginBorder,
  504. "MenuItem.font", dialogPlain12,
  505. "MenuItem.acceleratorFont", dialogPlain12,
  506. "MenuItem.foreground", table.get("menuText"),
  507. "MenuItem.background", table.get("menu"),
  508. "MenuItem.selectionForeground", menuItemPressedForeground,
  509. "MenuItem.selectionBackground", menuItemPressedBackground,
  510. "MenuItem.checkIcon", menuItemCheckIcon,
  511. "MenuItem.arrowIcon", menuItemArrowIcon,
  512. "RadioButtonMenuItem.border", menuMarginBorder,
  513. "RadioButtonMenuItem.font", dialogPlain12,
  514. "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
  515. "RadioButtonMenuItem.foreground", table.get("menuText"),
  516. "RadioButtonMenuItem.background", table.get("menu"),
  517. "RadioButtonMenuItem.selectionForeground", menuItemPressedForeground,
  518. "RadioButtonMenuItem.selectionBackground", menuItemPressedBackground,
  519. "RadioButtonMenuItem.checkIcon", radioButtonIcon,
  520. "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
  521. "CheckBoxMenuItem.border", menuMarginBorder,
  522. "CheckBoxMenuItem.font", dialogPlain12,
  523. "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
  524. "CheckBoxMenuItem.foreground", table.get("menuText"),
  525. "CheckBoxMenuItem.background", table.get("menu"),
  526. "CheckBoxMenuItem.selectionForeground", menuItemPressedForeground,
  527. "CheckBoxMenuItem.selectionBackground", menuItemPressedBackground,
  528. "CheckBoxMenuItem.checkIcon", checkBoxIcon,
  529. "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
  530. "PopupMenu.background", table.get("menu"),
  531. "PopupMenu.border", popupMenuBorder,
  532. "PopupMenu.foreground", table.get("menuText"),
  533. "PopupMenu.font", dialogPlain12,
  534. "Label.font", dialogPlain12,
  535. "Label.background", table.get("control"),
  536. "Label.foreground", table.get("controlText"),
  537. "Separator.shadow", table.get("controlShadow"), // DEPRECATED - DO NOT USE!
  538. "Separator.highlight", table.get("controlLtHighlight"), // DEPRECATED - DO NOT USE!
  539. "Separator.background", table.get("controlLtHighlight"),
  540. "Separator.foreground", table.get("controlShadow"),
  541. "List.focusCellHighlightBorder", focusCellHighlightBorder,
  542. "List.focusInputMap",
  543. new UIDefaults.LazyInputMap(new Object[] {
  544. "COPY", "copy",
  545. "PASTE", "paste",
  546. "CUT", "cut",
  547. "control INSERT", "copy",
  548. "shift INSERT", "paste",
  549. "shift DELETE", "cut",
  550. "UP", "selectPreviousRow",
  551. "KP_UP", "selectPreviousRow",
  552. "shift UP", "selectPreviousRowExtendSelection",
  553. "shift KP_UP", "selectPreviousRowExtendSelection",
  554. "DOWN", "selectNextRow",
  555. "KP_DOWN", "selectNextRow",
  556. "shift DOWN", "selectNextRowExtendSelection",
  557. "shift KP_DOWN", "selectNextRowExtendSelection",
  558. "LEFT", "selectPreviousColumn",
  559. "KP_LEFT", "selectPreviousColumn",
  560. "shift LEFT", "selectPreviousColumnExtendSelection",
  561. "shift KP_LEFT", "selectPreviousColumnExtendSelection",
  562. "RIGHT", "selectNextColumn",
  563. "KP_RIGHT", "selectNextColumn",
  564. "shift RIGHT", "selectNextColumnExtendSelection",
  565. "shift KP_RIGHT", "selectNextColumnExtendSelection",
  566. "ctrl SPACE", "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. "DesktopIcon.icon", LookAndFeel.makeIcon(getClass(),
  580. "icons/DesktopIcon.gif"),
  581. "DesktopIcon.border", null,
  582. // These are a little odd, MotifInternalFrameUI isntalls em!
  583. "DesktopIcon.windowBindings", new Object[]
  584. { "ESCAPE", "hideSystemMenu" },
  585. "InternalFrame.activeTitleBackground", table.get("activeCaptionBorder"),
  586. "InternalFrame.inactiveTitleBackground", table.get("inactiveCaptionBorder"),
  587. "InternalFrame.windowBindings", new Object[] {
  588. "shift ESCAPE", "showSystemMenu",
  589. "ctrl SPACE", "showSystemMenu",
  590. "ESCAPE", "hideSystemMenu"
  591. },
  592. "ScrollBar.background", scrollBarTrack,
  593. "ScrollBar.foreground", table.get("control"),
  594. "ScrollBar.track", scrollBarTrack,
  595. "ScrollBar.trackHighlight", table.get("controlDkShadow"),
  596. "ScrollBar.thumb", table.get("control"),
  597. "ScrollBar.thumbHighlight", table.get("controlHighlight"),
  598. "ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
  599. "ScrollBar.thumbShadow", table.get("controlShadow"),
  600. "ScrollBar.border", loweredBevelBorder,
  601. "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
  602. "ScrollBar.focusInputMap",
  603. new UIDefaults.LazyInputMap(new Object[] {
  604. "RIGHT", "positiveUnitIncrement",
  605. "KP_RIGHT", "positiveUnitIncrement",
  606. "DOWN", "positiveUnitIncrement",
  607. "KP_DOWN", "positiveUnitIncrement",
  608. "PAGE_DOWN", "positiveBlockIncrement",
  609. "ctrl PAGE_DOWN", "positiveBlockIncrement",
  610. "LEFT", "negativeUnitIncrement",
  611. "KP_LEFT", "negativeUnitIncrement",
  612. "UP", "negativeUnitIncrement",
  613. "KP_UP", "negativeUnitIncrement",
  614. "PAGE_UP", "negativeBlockIncrement",
  615. "ctrl PAGE_UP", "negativeBlockIncrement",
  616. "HOME", "minScroll",
  617. "END", "maxScroll"
  618. }),
  619. "ScrollPane.font", dialogPlain12,
  620. "ScrollPane.background", table.get("control"),
  621. "ScrollPane.foreground", table.get("controlText"),
  622. "ScrollPane.border", null,
  623. "ScrollPane.viewportBorder", loweredBevelBorder,
  624. "ScrollPane.ancestorInputMap",
  625. new UIDefaults.LazyInputMap(new Object[] {
  626. "RIGHT", "unitScrollRight",
  627. "KP_RIGHT", "unitScrollRight",
  628. "DOWN", "unitScrollDown",
  629. "KP_DOWN", "unitScrollDown",
  630. "LEFT", "unitScrollLeft",
  631. "KP_LEFT", "unitScrollLeft",
  632. "UP", "unitScrollUp",
  633. "KP_UP", "unitScrollUp",
  634. "PAGE_UP", "scrollUp",
  635. "PAGE_DOWN", "scrollDown",
  636. "ctrl PAGE_UP", "scrollLeft",
  637. "ctrl PAGE_DOWN", "scrollRight",
  638. "ctrl HOME", "scrollHome",
  639. "ctrl END", "scrollEnd"
  640. }),
  641. "Slider.border", focusBevelBorder,
  642. "Slider.foreground", table.get("control"),
  643. "Slider.background", controlDarker,
  644. "Slider.highlight", table.get("controlHighlight"),
  645. "Slider.shadow", table.get("controlShadow"),
  646. "Slider.focus", table.get("controlDkShadow"),
  647. "Slider.focusInsets", sliderFocusInsets,
  648. "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
  649. "RIGHT", "positiveUnitIncrement",
  650. "KP_RIGHT", "positiveUnitIncrement",
  651. "DOWN", "negativeUnitIncrement",
  652. "KP_DOWN", "negativeUnitIncrement",
  653. "ctrl PAGE_DOWN", "negativeBlockIncrement",
  654. "LEFT", "negativeUnitIncrement",
  655. "KP_LEFT", "negativeUnitIncrement",
  656. "UP", "positiveUnitIncrement",
  657. "KP_UP", "positiveUnitIncrement",
  658. "ctrl PAGE_UP", "positiveBlockIncrement",
  659. "HOME", "minScroll",
  660. "END", "maxScroll"
  661. }),
  662. // Spinner
  663. "Spinner.ancestorInputMap",
  664. new UIDefaults.LazyInputMap(new Object[] {
  665. "UP", "increment",
  666. "KP_UP", "increment",
  667. "DOWN", "decrement",
  668. "KP_DOWN", "decrement",
  669. }),
  670. "Spinner.border", textFieldBorder,
  671. "SplitPane.background", table.get("control"),
  672. "SplitPane.highlight", table.get("controlHighlight"),
  673. "SplitPane.shadow", table.get("controlShadow"),
  674. "SplitPane.dividerSize", new Integer(20),
  675. "SplitPane.activeThumb", table.get("activeCaptionBorder"),
  676. "SplitPane.ancestorInputMap",
  677. new UIDefaults.LazyInputMap(new Object[] {
  678. "UP", "negativeIncrement",
  679. "DOWN", "positiveIncrement",
  680. "LEFT", "negativeIncrement",
  681. "RIGHT", "positiveIncrement",
  682. "KP_UP", "negativeIncrement",
  683. "KP_DOWN", "positiveIncrement",
  684. "KP_LEFT", "negativeIncrement",
  685. "KP_RIGHT", "positiveIncrement",
  686. "HOME", "selectMin",
  687. "END", "selectMax",
  688. "F8", "startResize",
  689. "F6", "toggleFocus",
  690. "ctrl TAB", "focusOutForward",
  691. "ctrl shift TAB", "focusOutBackward"
  692. }),
  693. "TabbedPane.font", dialogPlain12,
  694. "TabbedPane.background", table.get("control"),
  695. "TabbedPane.foreground", table.get("controlText"),
  696. "TabbedPane.light", table.get("controlHighlight"),
  697. "TabbedPane.highlight", table.get("controlLtHighlight"),
  698. "TabbedPane.shadow", table.get("controlShadow"),
  699. "TabbedPane.darkShadow", table.get("controlShadow"),
  700. "TabbedPane.unselectedTabBackground", unselectedTabBackground,
  701. "TabbedPane.unselectedTabForeground", unselectedTabForeground,
  702. "TabbedPane.unselectedTabHighlight", unselectedTabHighlight,
  703. "TabbedPane.unselectedTabShadow", unselectedTabShadow,
  704. "TabbedPane.focus", table.get("activeCaptionBorder"),
  705. "TabbedPane.tabInsets", tabbedPaneTabInsets,
  706. "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
  707. "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
  708. "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
  709. "TabbedPane.focusInputMap",
  710. new UIDefaults.LazyInputMap(new Object[] {
  711. "RIGHT", "navigateRight",
  712. "KP_RIGHT", "navigateRight",
  713. "LEFT", "navigateLeft",
  714. "KP_LEFT", "navigateLeft",
  715. "UP", "navigateUp",
  716. "KP_UP", "navigateUp",
  717. "DOWN", "navigateDown",
  718. "KP_DOWN", "navigateDown",
  719. "ctrl DOWN", "requestFocusForVisibleComponent",
  720. "ctrl KP_DOWN", "requestFocusForVisibleComponent",
  721. }),
  722. "TabbedPane.ancestorInputMap",
  723. new UIDefaults.LazyInputMap(new Object[] {
  724. "ctrl PAGE_DOWN", "navigatePageDown",
  725. "ctrl PAGE_UP", "navigatePageUp",
  726. "ctrl UP", "requestFocus",
  727. "ctrl KP_UP", "requestFocus",
  728. }),
  729. "Tree.background", controlDarker, // default: dark slate blue
  730. "Tree.hash", table.get("controlDkShadow"), // default: black
  731. "Tree.iconShadow", table.get("controlShadow"),
  732. "Tree.iconHighlight", table.get("controlHighlight"),
  733. "Tree.iconBackground", table.get("control"),
  734. "Tree.iconForeground", table.get("controlShadow"), // default: black
  735. "Tree.textBackground", controlDarker, // default: dark slate blue
  736. "Tree.textForeground", table.get("textText"), // default: black
  737. "Tree.selectionBackground", table.get("text"), // default: white
  738. "Tree.selectionForeground", table.get("textText"), // default: black
  739. "Tree.selectionBorderColor", table.get("activeCaptionBorder"), // default: maroon
  740. "Tree.openIcon", treeOpenIcon,
  741. "Tree.closedIcon", treeClosedIcon,
  742. "Tree.leafIcon", treeLeafIcon,
  743. "Tree.expandedIcon", treeExpandedIcon,
  744. "Tree.collapsedIcon", treeCollapsedIcon,
  745. "Tree.editorBorder", focusBorder,
  746. "Tree.editorBorderSelectionColor", table.get("activeCaptionBorder"),
  747. "Tree.rowHeight", new Integer(18),
  748. "Tree.drawsFocusBorderAroundIcon", Boolean.TRUE,
  749. "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
  750. "COPY", "copy",
  751. "PASTE", "paste",
  752. "CUT", "cut",
  753. "control INSERT", "copy",
  754. "shift INSERT", "paste",
  755. "shift DELETE", "cut",
  756. "UP", "selectPreviousChangeLead",
  757. "KP_UP", "selectPreviousChangeLead",
  758. "shift UP", "selectPreviousExtendSelection",
  759. "shift KP_UP", "selectPreviousExtendSelection",
  760. "DOWN", "selectNextChangeLead",
  761. "KP_DOWN", "selectNextChangeLead",
  762. "shift DOWN", "selectNextExtendSelection",
  763. "shift KP_DOWN", "selectNextExtendSelection",
  764. "RIGHT", "selectChildChangeLead",
  765. "KP_RIGHT", "selectChildChangeLead",
  766. "LEFT", "selectParentChangeLead",
  767. "KP_LEFT", "selectParentChangeLead",
  768. "PAGE_UP", "scrollUpChangeLead",
  769. "shift PAGE_UP", "scrollUpExtendSelection",
  770. "PAGE_DOWN", "scrollDownChangeLead",
  771. "shift PAGE_DOWN", "scrollDownExtendSelection",
  772. "HOME", "selectFirstChangeLead",
  773. "shift HOME", "selectFirstExtendSelection",
  774. "END", "selectLastChangeLead",
  775. "shift END", "selectLastExtendSelection",
  776. "F2", "startEditing",
  777. "ctrl A", "selectAll",
  778. "ctrl SLASH", "selectAll",
  779. "ctrl BACK_SLASH", "clearSelection",
  780. "ctrl SPACE", "selectItem",
  781. "shift SPACE", "extendSelection",
  782. "ctrl PAGE_DOWN", "scrollRightChangeLead",
  783. "ctrl PAGE_UP", "scrollLeftChangeLead",
  784. "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
  785. "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
  786. "SPACE", "toggleSelection",
  787. }),
  788. "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
  789. "ESCAPE", "cancel" }),
  790. "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  791. "Table.scrollPaneBorder", null,
  792. // "Table.background", white, // cell background color
  793. // "Table.focusCellBackground", white,
  794. "Table.ancestorInputMap",
  795. new UIDefaults.LazyInputMap(new Object[] {
  796. "COPY", "copy",
  797. "PASTE", "paste",
  798. "CUT", "cut",
  799. "control INSERT", "copy",
  800. "shift INSERT", "paste",
  801. "shift DELETE", "cut",
  802. "RIGHT", "selectNextColumn",
  803. "KP_RIGHT", "selectNextColumn",
  804. "LEFT", "selectPreviousColumn",
  805. "KP_LEFT", "selectPreviousColumn",
  806. "DOWN", "selectNextRow",
  807. "KP_DOWN", "selectNextRow",
  808. "UP", "selectPreviousRow",
  809. "KP_UP", "selectPreviousRow",
  810. "shift RIGHT", "selectNextColumnExtendSelection",
  811. "shift KP_RIGHT", "selectNextColumnExtendSelection",
  812. "shift LEFT", "selectPreviousColumnExtendSelection",
  813. "shift KP_LEFT", "selectPreviousColumnExtendSelection",
  814. "shift DOWN", "selectNextRowExtendSelection",
  815. "shift KP_DOWN", "selectNextRowExtendSelection",
  816. "shift UP", "selectPreviousRowExtendSelection",
  817. "shift KP_UP", "selectPreviousRowExtendSelection",
  818. "PAGE_UP", "scrollUpChangeSelection",
  819. "PAGE_DOWN", "scrollDownChangeSelection",
  820. "HOME", "selectFirstColumn",
  821. "END", "selectLastColumn",
  822. "shift PAGE_UP", "scrollUpExtendSelection",
  823. "shift PAGE_DOWN", "scrollDownExtendSelection",
  824. "shift HOME", "selectFirstColumnExtendSelection",
  825. "shift END", "selectLastColumnExtendSelection",
  826. "ctrl PAGE_UP", "scrollLeftChangeSelection",
  827. "ctrl PAGE_DOWN", "scrollRightChangeSelection",
  828. "ctrl HOME", "selectFirstRow",
  829. "ctrl END", "selectLastRow",
  830. "ctrl shift PAGE_UP", "scrollRightExtendSelection",
  831. "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
  832. "ctrl shift HOME", "selectFirstRowExtendSelection",
  833. "ctrl shift END", "selectLastRowExtendSelection",
  834. "TAB", "selectNextColumnCell",
  835. "shift TAB", "selectPreviousColumnCell",
  836. "ENTER", "selectNextRowCell",
  837. "shift ENTER", "selectPreviousRowCell",
  838. "ctrl A", "selectAll",
  839. "ESCAPE", "cancel",
  840. "F2", "startEditing"
  841. }),
  842. "FormattedTextField.focusInputMap",
  843. new UIDefaults.LazyInputMap(new Object[] {
  844. "ctrl C", DefaultEditorKit.copyAction,
  845. "ctrl V", DefaultEditorKit.pasteAction,
  846. "ctrl X", DefaultEditorKit.cutAction,
  847. "COPY", DefaultEditorKit.copyAction,
  848. "PASTE", DefaultEditorKit.pasteAction,
  849. "CUT", DefaultEditorKit.cutAction,
  850. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  851. "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
  852. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  853. "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
  854. "ctrl LEFT", DefaultEditorKit.previousWordAction,
  855. "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
  856. "ctrl RIGHT", DefaultEditorKit.nextWordAction,
  857. "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
  858. "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  859. "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
  860. "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  861. "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
  862. "ctrl A", DefaultEditorKit.selectAllAction,
  863. "HOME", DefaultEditorKit.beginLineAction,
  864. "END", DefaultEditorKit.endLineAction,
  865. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  866. "shift END", DefaultEditorKit.selectionEndLineAction,
  867. "typed \010", DefaultEditorKit.deletePrevCharAction,
  868. "DELETE", DefaultEditorKit.deleteNextCharAction,
  869. "RIGHT", DefaultEditorKit.forwardAction,
  870. "LEFT", DefaultEditorKit.backwardAction,
  871. "KP_RIGHT", DefaultEditorKit.forwardAction,
  872. "KP_LEFT", DefaultEditorKit.backwardAction,
  873. "ENTER", JTextField.notifyAction,
  874. "ctrl BACK_SLASH", "unselect",
  875. "control shift O", "toggle-componentOrientation",
  876. "ESCAPE", "reset-field-edit",
  877. "UP", "increment",
  878. "KP_UP", "increment",
  879. "DOWN", "decrement",
  880. "KP_DOWN", "decrement",
  881. }),
  882. // ToolBar.
  883. "ToolBar.ancestorInputMap",
  884. new UIDefaults.LazyInputMap(new Object[] {
  885. "UP", "navigateUp",
  886. "KP_UP", "navigateUp",
  887. "DOWN", "navigateDown",
  888. "KP_DOWN", "navigateDown",
  889. "LEFT", "navigateLeft",
  890. "KP_LEFT", "navigateLeft",
  891. "RIGHT", "navigateRight",
  892. "KP_RIGHT", "navigateRight"
  893. }),
  894. "ComboBox.control", table.get("control"),
  895. "ComboBox.controlForeground", black,
  896. "ComboBox.background", table.get("window"),
  897. "ComboBox.foreground", black,
  898. "ComboBox.border", comboBoxBorder,
  899. "ComboBox.selectionBackground", black,
  900. "ComboBox.selectionForeground", table.get("text"),
  901. "ComboBox.disabledBackground", table.get("control"),
  902. "ComboBox.disabledForeground", table.get("textInactiveText"),
  903. "ComboBox.font", dialogPlain12,
  904. "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
  905. "ESCAPE", "hidePopup",
  906. "PAGE_UP", "pageUpPassThrough",
  907. "PAGE_DOWN", "pageDownPassThrough",
  908. "HOME", "homePassThrough",
  909. "END", "endPassThrough",
  910. "DOWN", "selectNext",
  911. "KP_DOWN", "selectNext",
  912. "UP", "selectPrevious",
  913. "KP_UP", "selectPrevious"
  914. }),
  915. "TextField.caretForeground", black,
  916. "TextField.caretBlinkRate", new Integer(500),
  917. "TextField.inactiveForeground", table.get("textInactiveText"),
  918. "TextField.selectionBackground", table.get("textHighlight"),
  919. "TextField.selectionForeground", table.get("textHighlightText"),
  920. "TextField.background", table.get("window"),
  921. "TextField.foreground", table.get("textText"),
  922. "TextField.font", sansSerifPlain12,
  923. "TextField.border", textFieldBorder,
  924. "TextField.focusInputMap", fieldInputMap,
  925. "PasswordField.caretForeground", black,
  926. "PasswordField.caretBlinkRate", new Integer(500),
  927. "PasswordField.inactiveForeground", table.get("textInactiveText"),
  928. "PasswordField.selectionBackground", table.get("textHighlight"),
  929. "PasswordField.selectionForeground", table.get("textHighlightText"),
  930. "PasswordField.background", table.get("window"),
  931. "PasswordField.foreground", table.get("textText"),
  932. "PasswordField.font", monospacedPlain12,
  933. "PasswordField.border", textFieldBorder,
  934. "PasswordField.focusInputMap", fieldInputMap,
  935. "TextArea.caretForeground", black,
  936. "TextArea.caretBlinkRate", new Integer(500),
  937. "TextArea.inactiveForeground", table.get("textInactiveText"),
  938. "TextArea.selectionBackground", table.get("textHighlight"),
  939. "TextArea.selectionForeground", table.get("textHighlightText"),
  940. "TextArea.background", table.get("window"),
  941. "TextArea.foreground", table.get("textText"),
  942. "TextArea.font", monospacedPlain12,
  943. "TextArea.border", marginBorder,
  944. "TextArea.focusInputMap", multilineInputMap,
  945. "TextPane.caretForeground", black,
  946. "TextPane.caretBlinkRate", new Integer(500),
  947. "TextPane.inactiveForeground", table.get("textInactiveText"),
  948. "TextPane.selectionBackground", lightGray,
  949. "TextPane.selectionForeground", table.get("textHighlightText"),
  950. "TextPane.background", white,
  951. "TextPane.foreground", table.get("textText"),
  952. "TextPane.font", serifPlain12,
  953. "TextPane.border", marginBorder,
  954. "TextPane.focusInputMap", multilineInputMap,
  955. "EditorPane.caretForeground", red,
  956. "EditorPane.caretBlinkRate", new Integer(500),
  957. "EditorPane.inactiveForeground", table.get("textInactiveText"),
  958. "EditorPane.selectionBackground", lightGray,
  959. "EditorPane.selectionForeground", table.get("textHighlightText"),
  960. "EditorPane.background", white,
  961. "EditorPane.foreground", table.get("textText"),
  962. "EditorPane.font", serifPlain12,
  963. "EditorPane.border", marginBorder,
  964. "EditorPane.focusInputMap", multilineInputMap,
  965. "FileChooser.pathLabelMnemonic", new Integer(KeyEvent.VK_P), // 'p'
  966. "FileChooser.filterLabelMnemonic", new Integer (KeyEvent.VK_R), // 'r'
  967. "FileChooser.foldersLabelMnemonic", new Integer (KeyEvent.VK_L), // 'l'
  968. "FileChooser.filesLabelMnemonic", new Integer (KeyEvent.VK_I), // 'i'
  969. "FileChooser.enterFileNameLabelMnemonic", new Integer (KeyEvent.VK_N), // 'n'
  970. "FileChooser.ancestorInputMap",
  971. new UIDefaults.LazyInputMap(new Object[] {
  972. "ESCAPE", "cancelSelection"
  973. }),
  974. "ToolTip.border", raisedBevelBorder,
  975. "ToolTip.background", table.get("info"),
  976. "ToolTip.foreground", table.get("infoText"),
  977. // These window InputMap bindings are used when the Menu is
  978. // selected.
  979. "PopupMenu.selectedWindowInputMapBindings", new Object[] {
  980. "ESCAPE", "cancel",
  981. "TAB", "cancel",
  982. "shift TAB", "cancel",
  983. "DOWN", "selectNext",
  984. "KP_DOWN", "selectNext",
  985. "UP", "selectPrevious",
  986. "KP_UP", "selectPrevious",
  987. "LEFT", "selectParent",
  988. "KP_LEFT", "selectParent",
  989. "RIGHT", "selectChild",
  990. "KP_RIGHT", "selectChild",
  991. "ENTER", "return",
  992. "SPACE", "return"
  993. },
  994. "OptionPane.border", optionPaneBorder,
  995. "OptionPane.messageAreaBorder", optionPaneMessageAreaBorder,
  996. "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
  997. "OptionPane.errorIcon", LookAndFeel.makeIcon(getClass(),
  998. "icons/Error.gif"),
  999. "OptionPane.informationIcon", LookAndFeel.makeIcon(getClass(),
  1000. "icons/Inform.gif"),
  1001. "OptionPane.warningIcon", LookAndFeel.makeIcon(getClass(),
  1002. "icons/Warn.gif"),
  1003. "OptionPane.questionIcon", LookAndFeel.makeIcon(getClass(),
  1004. "icons/Question.gif"),
  1005. "OptionPane.windowBindings", new Object[] {
  1006. "ESCAPE", "close" },
  1007. // These bindings are only enabled when there is a default
  1008. // button set on the rootpane.
  1009. "RootPane.defaultButtonWindowKeyBindings", new Object[] {
  1010. "ENTER", "press",
  1011. "released ENTER", "release",
  1012. "ctrl ENTER", "press",
  1013. "ctrl released ENTER", "release"
  1014. },
  1015. };
  1016. table.putDefaults(defaults);
  1017. }
  1018. /*
  1019. * Returns whether this is being run on a JDK 1.2 or later VM.
  1020. * This is a system-wide, rather than AppContext-wide, state.
  1021. */
  1022. /*package-private*/ static boolean is1dot2 = true;
  1023. static {
  1024. try {
  1025. // Test if method introduced in 1.2 is available.
  1026. Method m = Toolkit.class.getMethod("getMaximumCursorColors", null);
  1027. is1dot2 = (m != null);
  1028. } catch (NoSuchMethodException e) {
  1029. is1dot2 = false;
  1030. }
  1031. }
  1032. }