1. /*
  2. * @(#)WindowsLookAndFeel.java 1.71 00/02/02
  3. *
  4. * Copyright 1997-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 com.sun.java.swing.plaf.windows;
  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.awt.Font;
  19. import java.awt.Color;
  20. import java.awt.SystemColor;
  21. import java.awt.event.KeyEvent;
  22. import java.awt.event.InputEvent;
  23. import java.net.URL;
  24. import java.io.Serializable;
  25. import java.util.*;
  26. /**
  27. * Implements the Windows95 Look and Feel.
  28. * UI classes not implemented specifically for Windows will
  29. * default to those implemented in Basic.
  30. * <p>
  31. * For the keyboard keys defined for each component in this Look and
  32. * Feel (L&F), see
  33. * <a href="../../../../../../javax/swing/doc-files/Key-Win32.html">Component Keystroke Actions for the Windows L&F</a>.
  34. * <p>
  35. * <strong>Warning:</strong>
  36. * Serialized objects of this class will not be compatible with
  37. * future Swing releases. The current serialization support is appropriate
  38. * for short term storage or RMI between applications running the same
  39. * version of Swing. A future release of Swing will provide support for
  40. * long term persistence.
  41. *
  42. * @version 1.71 02/02/00
  43. * @author unattributed
  44. */
  45. public class WindowsLookAndFeel extends BasicLookAndFeel
  46. {
  47. public String getName() {
  48. return "Windows";
  49. }
  50. public String getDescription() {
  51. return "The Microsoft Windows Look and Feel";
  52. }
  53. public String getID() {
  54. return "Windows";
  55. }
  56. public boolean isNativeLookAndFeel() {
  57. String osName = System.getProperty("os.name");
  58. return (osName != null) && (osName.indexOf("Windows") != -1);
  59. }
  60. public boolean isSupportedLookAndFeel() {
  61. return isNativeLookAndFeel();
  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 windowsPackageName = "com.sun.java.swing.plaf.windows.";
  76. Object[] uiDefaults = {
  77. "ButtonUI", windowsPackageName + "WindowsButtonUI",
  78. "CheckBoxUI", windowsPackageName + "WindowsCheckBoxUI",
  79. "RadioButtonUI", windowsPackageName + "WindowsRadioButtonUI",
  80. "ToggleButtonUI", windowsPackageName + "WindowsToggleButtonUI",
  81. "ProgressBarUI", windowsPackageName + "WindowsProgressBarUI",
  82. "SplitPaneUI", windowsPackageName + "WindowsSplitPaneUI",
  83. "TextAreaUI", windowsPackageName + "WindowsTextAreaUI",
  84. "TextFieldUI", windowsPackageName + "WindowsTextFieldUI",
  85. "PasswordFieldUI", windowsPackageName + "WindowsPasswordFieldUI",
  86. "TextPaneUI", windowsPackageName + "WindowsTextPaneUI",
  87. "EditorPaneUI", windowsPackageName + "WindowsEditorPaneUI",
  88. "TreeUI", windowsPackageName + "WindowsTreeUI",
  89. "ComboBoxUI", windowsPackageName + "WindowsComboBoxUI",
  90. "InternalFrameUI", windowsPackageName + "WindowsInternalFrameUI",
  91. "DesktopPaneUI", windowsPackageName + "WindowsDesktopPaneUI",
  92. "FileChooserUI", windowsPackageName + "WindowsFileChooserUI",
  93. };
  94. table.putDefaults(uiDefaults);
  95. }
  96. /**
  97. * Load the SystemColors into the defaults table. The keys
  98. * for SystemColor defaults are the same as the names of
  99. * the public fields in SystemColor. If the table is being
  100. * created on a native Windows platform we use the SystemColor
  101. * values, otherwise we create color objects whose values match
  102. * the defaults Windows95 colors.
  103. */
  104. protected void initSystemColorDefaults(UIDefaults table)
  105. {
  106. String[] defaultSystemColors = {
  107. "desktop", "#005C5C", /* Color of the desktop background */
  108. "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
  109. "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
  110. "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
  111. "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
  112. "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
  113. "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
  114. "window", "#FFFFFF", /* Default color for the interior of windows */
  115. "windowBorder", "#000000", /* ??? */
  116. "windowText", "#000000", /* ??? */
  117. "menu", "#C0C0C0", /* Background color for menus */
  118. "menuPressedItemB", "#000080", /* LightShadow of menubutton highlight */
  119. "menuPressedItemF", "#FFFFFF", /* Default color for foreground "text" in menu item */
  120. "menuText", "#000000", /* Text color for menus */
  121. "text", "#C0C0C0", /* Text background color */
  122. "textText", "#000000", /* Text foreground color */
  123. "textHighlight", "#000080", /* Text background color when selected */
  124. "textHighlightText", "#FFFFFF", /* Text color when selected */
  125. "textInactiveText", "#808080", /* Text color when disabled */
  126. "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
  127. "controlText", "#000000", /* Default color for text in controls */
  128. "controlHighlight", "#C0C0C0",
  129. /*"controlHighlight", "#E0E0E0",*/ /* Specular highlight (opposite of the shadow) */
  130. "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
  131. "controlShadow", "#808080", /* Shadow color for controls */
  132. "controlDkShadow", "#000000", /* Dark shadow color for controls */
  133. "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
  134. "info", "#FFFFE1", /* ??? */
  135. "infoText", "#000000" /* ??? */
  136. };
  137. loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
  138. }
  139. private void loadResourceBundle(UIDefaults table) {
  140. ResourceBundle bundle = ResourceBundle.getBundle("com.sun.java.swing.plaf.windows.resources.windows");
  141. Enumeration iter = bundle.getKeys();
  142. while(iter.hasMoreElements()) {
  143. String key = (String)iter.nextElement();
  144. //System.out.println("key :" +key+ " value: " + bundle.getObject(key));
  145. table.put( key, bundle.getObject(key) );
  146. }
  147. }
  148. protected void initComponentDefaults(UIDefaults table)
  149. {
  150. super.initComponentDefaults( table );
  151. loadResourceBundle(table);
  152. // *** Fonts
  153. FontUIResource dialogPlain12 = new FontUIResource("Dialog", Font.PLAIN, 12);
  154. FontUIResource serifPlain12 = new FontUIResource("Serif", Font.PLAIN, 12);
  155. FontUIResource sansSerifPlain12 = new FontUIResource("SansSerif", Font.PLAIN, 12);
  156. FontUIResource monospacedPlain12 = new FontUIResource("Monospaced", Font.PLAIN, 12);
  157. // *** Colors
  158. ColorUIResource red = new ColorUIResource(Color.red);
  159. ColorUIResource black = new ColorUIResource(Color.black);
  160. ColorUIResource white = new ColorUIResource(Color.white);
  161. ColorUIResource yellow = new ColorUIResource(Color.yellow);
  162. ColorUIResource gray = new ColorUIResource(Color.gray);
  163. ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
  164. ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
  165. ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224);
  166. // *** Tree
  167. ColorUIResource treeSelection = new ColorUIResource(0, 0, 128);
  168. Object treeExpandedIcon = WindowsTreeUI.ExpandedIcon.createExpandedIcon();
  169. Object treeCollapsedIcon = WindowsTreeUI.CollapsedIcon.createCollapsedIcon();
  170. // *** Text
  171. Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
  172. "control C", DefaultEditorKit.copyAction,
  173. "control V", DefaultEditorKit.pasteAction,
  174. "control X", DefaultEditorKit.cutAction,
  175. "COPY", DefaultEditorKit.copyAction,
  176. "PASTE", DefaultEditorKit.pasteAction,
  177. "CUT", DefaultEditorKit.cutAction,
  178. "control INSERT", DefaultEditorKit.copyAction,
  179. "shift INSERT", DefaultEditorKit.pasteAction,
  180. "shift DELETE", DefaultEditorKit.cutAction,
  181. "control A", DefaultEditorKit.selectAllAction,
  182. "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
  183. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  184. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  185. "control LEFT", DefaultEditorKit.previousWordAction,
  186. "control RIGHT", DefaultEditorKit.nextWordAction,
  187. "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  188. "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  189. "HOME", DefaultEditorKit.beginLineAction,
  190. "END", DefaultEditorKit.endLineAction,
  191. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  192. "shift END", DefaultEditorKit.selectionEndLineAction,
  193. "typed \010", DefaultEditorKit.deletePrevCharAction,
  194. "DELETE", DefaultEditorKit.deleteNextCharAction,
  195. "RIGHT", DefaultEditorKit.forwardAction,
  196. "LEFT", DefaultEditorKit.backwardAction,
  197. "KP_RIGHT", DefaultEditorKit.forwardAction,
  198. "KP_LEFT", DefaultEditorKit.backwardAction,
  199. "ENTER", JTextField.notifyAction,
  200. "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
  201. });
  202. Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
  203. "control C", DefaultEditorKit.copyAction,
  204. "control V", DefaultEditorKit.pasteAction,
  205. "control X", DefaultEditorKit.cutAction,
  206. "COPY", DefaultEditorKit.copyAction,
  207. "PASTE", DefaultEditorKit.pasteAction,
  208. "CUT", DefaultEditorKit.cutAction,
  209. "control INSERT", DefaultEditorKit.copyAction,
  210. "shift INSERT", DefaultEditorKit.pasteAction,
  211. "shift DELETE", DefaultEditorKit.cutAction,
  212. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  213. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  214. "control LEFT", DefaultEditorKit.previousWordAction,
  215. "control RIGHT", DefaultEditorKit.nextWordAction,
  216. "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  217. "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  218. "control A", DefaultEditorKit.selectAllAction,
  219. "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
  220. "HOME", DefaultEditorKit.beginLineAction,
  221. "END", DefaultEditorKit.endLineAction,
  222. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  223. "shift END", DefaultEditorKit.selectionEndLineAction,
  224. "control HOME", DefaultEditorKit.beginAction,
  225. "control END", DefaultEditorKit.endAction,
  226. "control shift HOME", DefaultEditorKit.selectionBeginAction,
  227. "control shift END", DefaultEditorKit.selectionEndAction,
  228. "UP", DefaultEditorKit.upAction,
  229. "DOWN", DefaultEditorKit.downAction,
  230. "typed \010", DefaultEditorKit.deletePrevCharAction,
  231. "DELETE", DefaultEditorKit.deleteNextCharAction,
  232. "RIGHT", DefaultEditorKit.forwardAction,
  233. "LEFT", DefaultEditorKit.backwardAction,
  234. "KP_RIGHT", DefaultEditorKit.forwardAction,
  235. "KP_LEFT", DefaultEditorKit.backwardAction,
  236. "PAGE_UP", DefaultEditorKit.pageUpAction,
  237. "PAGE_DOWN", DefaultEditorKit.pageDownAction,
  238. "shift PAGE_UP", "selection-page-up",
  239. "shift PAGE_DOWN", "selection-page-down",
  240. "ctrl shift PAGE_UP", "selection-page-left",
  241. "ctrl shift PAGE_DOWN", "selection-page-right",
  242. "shift UP", DefaultEditorKit.selectionUpAction,
  243. "shift DOWN", DefaultEditorKit.selectionDownAction,
  244. "ENTER", DefaultEditorKit.insertBreakAction,
  245. "TAB", DefaultEditorKit.insertTabAction,
  246. "control T", "next-link-action",
  247. "control shift T", "previous-link-action",
  248. "control SPACE", "activate-link-action",
  249. "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
  250. });
  251. Border marginBorder = new BasicBorders.MarginBorder();
  252. Object checkBoxIcon = WindowsIconFactory.getCheckBoxIcon();
  253. Object radioButtonIcon =WindowsIconFactory.getRadioButtonIcon();
  254. // *** ProgressBar
  255. Object progressBarBorder = new BorderUIResource.CompoundBorderUIResource(
  256. new WindowsBorders.ProgressBarBorder(
  257. table.getColor("controlShadow"),
  258. table.getColor("controlLtHighlight")),
  259. new EmptyBorder(1,1,1,1)
  260. );
  261. // *** ToolTips
  262. Object toolTipBorder = BorderUIResource.getBlackLineBorderUIResource();
  263. Object radioButtonBorder = new BorderUIResource.CompoundBorderUIResource(
  264. new BasicBorders.RadioButtonBorder(
  265. table.getColor("controlShadow"),
  266. table.getColor("controlDkShadow"),
  267. table.getColor("controlHighlight"),
  268. table.getColor("controlLtHighlight")),
  269. marginBorder);
  270. /*
  271. Object comboBoxBorder = new WindowsBorders.ComboBoxBorder(
  272. table.getColor("controlShadow"),
  273. table.getColor("controlDkShadow"),
  274. table.getColor("controlHighlight"));
  275. */
  276. Object comboBoxBorder = new BasicBorders.FieldBorder(
  277. table.getColor("controlShadow"),
  278. table.getColor("controlDkShadow"),
  279. table.getColor("controlHighlight"),
  280. table.getColor("controlLtHighlight"));
  281. Object menuItemCheckIcon = WindowsIconFactory.getMenuItemCheckIcon();
  282. Object menuItemArrowIcon = WindowsIconFactory.getMenuItemArrowIcon();
  283. Object menuArrowIcon = WindowsIconFactory.getMenuArrowIcon();
  284. Object menuItemAcceleratorDelimiter = new String("+");
  285. Object[] defaults = {
  286. "TextField.focusInputMap", fieldInputMap,
  287. "PasswordField.focusInputMap", fieldInputMap,
  288. "TextArea.focusInputMap", multilineInputMap,
  289. "TextPane.focusInputMap", multilineInputMap,
  290. "EditorPane.focusInputMap", multilineInputMap,
  291. // Buttons
  292. "Button.dashedRectGapX", new Integer(5),
  293. "Button.dashedRectGapY", new Integer(4),
  294. "Button.dashedRectGapWidth", new Integer(10),
  295. "Button.dashedRectGapHeight", new Integer(8),
  296. "Button.textShiftOffset", new Integer(1),
  297. "Button.focus", black,
  298. "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
  299. "SPACE", "pressed",
  300. "released SPACE", "released"
  301. }),
  302. "CheckBox.background", table.get("control"),
  303. "CheckBox.shadow", table.get("controlShadow"),
  304. "CheckBox.darkShadow", table.get("controlDkShadow"),
  305. "CheckBox.highlight", table.get("window"),
  306. "CheckBox.icon", checkBoxIcon,
  307. "CheckBox.border", radioButtonBorder,
  308. "CheckBox.focus", black,
  309. "CheckBox.focusInputMap",
  310. new UIDefaults.LazyInputMap(new Object[] {
  311. "SPACE", "pressed",
  312. "released SPACE", "released"
  313. }),
  314. "RadioButton.background", table.get("control"),
  315. "RadioButton.shadow", table.get("controlShadow"),
  316. "RadioButton.darkShadow", table.get("controlDkShadow"),
  317. "RadioButton.highlight", table.get("window"),
  318. "RadioButton.icon", radioButtonIcon,
  319. "RadioButton.border", radioButtonBorder,
  320. "RadioButton.focus", black,
  321. "RadioButton.focusInputMap",
  322. new UIDefaults.LazyInputMap(new Object[] {
  323. "SPACE", "pressed",
  324. "released SPACE", "released"
  325. }),
  326. "ToggleButton.textShiftOffset", new Integer(1),
  327. "ToggleButton.focus", black,
  328. "ToggleButton.border", radioButtonBorder,
  329. "ToggleButton.background", table.get("control"),
  330. "ToggleButton.foreground", table.get("controlText"),
  331. "ToggleButton.focus", table.get("controlText"),
  332. "ToggleButton.font", dialogPlain12,
  333. "ToggleButton.focusInputMap",
  334. new UIDefaults.LazyInputMap(new Object[] {
  335. "SPACE", "pressed",
  336. "released SPACE", "released"
  337. }),
  338. "ComboBox.border", comboBoxBorder,
  339. "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
  340. "ESCAPE", "hidePopup",
  341. "PAGE_UP", "pageUpPassThrough",
  342. "PAGE_DOWN", "pageDownPassThrough",
  343. "HOME", "homePassThrough",
  344. "END", "endPassThrough",
  345. "DOWN", "selectNext",
  346. "KP_DOWN", "selectNext",
  347. "UP", "selectPrevious",
  348. "KP_UP", "selectPrevious"
  349. }),
  350. // DeskTop.
  351. "Desktop.ancestorInputMap",
  352. new UIDefaults.LazyInputMap(new Object[] {
  353. "ctrl F5", "restore",
  354. "ctrl F4", "close",
  355. "ctrl F7", "move",
  356. "ctrl F8", "resize",
  357. "RIGHT", "right",
  358. "KP_RIGHT", "right",
  359. "LEFT", "left",
  360. "KP_LEFT", "left",
  361. "UP", "up",
  362. "KP_UP", "up",
  363. "DOWN", "down",
  364. "KP_DOWN", "down",
  365. "ESCAPE", "escape",
  366. "ctrl F9", "minimize",
  367. "ctrl F10", "maximize",
  368. "ctrl F6", "selectNextFrame",
  369. "ctrl TAB", "selectNextFrame",
  370. "ctrl alt F6", "selectNextFrame",
  371. "shift ctrl alt F6", "selectPreviousFrame"
  372. }),
  373. // List.
  374. "List.focusInputMap",
  375. new UIDefaults.LazyInputMap(new Object[] {
  376. "UP", "selectPreviousRow",
  377. "KP_UP", "selectPreviousRow",
  378. "shift UP", "selectPreviousRowExtendSelection",
  379. "shift KP_UP", "selectPreviousRowExtendSelection",
  380. "DOWN", "selectNextRow",
  381. "KP_DOWN", "selectNextRow",
  382. "shift DOWN", "selectNextRowExtendSelection",
  383. "shift KP_DOWN", "selectNextRowExtendSelection",
  384. "ctrl SPACE", "selectNextRowExtendSelection",
  385. "HOME", "selectFirstRow",
  386. "shift HOME", "selectFirstRowExtendSelection",
  387. "END", "selectLastRow",
  388. "shift END", "selectLastRowExtendSelection",
  389. "PAGE_UP", "scrollUp",
  390. "shift PAGE_UP", "scrollUpExtendSelection",
  391. "PAGE_DOWN", "scrollDown",
  392. "shift PAGE_DOWN", "scrollDownExtendSelection",
  393. "ctrl A", "selectAll",
  394. "ctrl SLASH", "selectAll",
  395. "ctrl BACK_SLASH", "clearSelection"
  396. }),
  397. // Menus
  398. "Menu.border", marginBorder,
  399. "Menu.font", dialogPlain12,
  400. "Menu.foreground", table.get("menuText"),
  401. "Menu.background", table.get("menu"),
  402. "Menu.selectionForeground", table.get("textHighlightText"),
  403. "Menu.selectionBackground", table.get("textHighlight"),
  404. "Menu.arrowIcon", menuArrowIcon,
  405. // These window InputMap bindings are used when the Menu is
  406. // selected.
  407. "Menu.selectedWindowInputMapBindings", new Object[] {
  408. "ESCAPE", "cancel",
  409. "DOWN", "selectNext",
  410. "KP_DOWN", "selectNext",
  411. "UP", "selectPrevious",
  412. "KP_UP", "selectPrevious",
  413. "LEFT", "selectParent",
  414. "KP_LEFT", "selectParent",
  415. "RIGHT", "selectChild",
  416. "KP_RIGHT", "selectChild",
  417. "ENTER", "return",
  418. "SPACE", "return"
  419. },
  420. // MenuBar.
  421. "MenuBar.windowBindings", new Object[] {
  422. "F10", "takeFocus" },
  423. "MenuItem.border", marginBorder,
  424. "MenuItem.font", dialogPlain12,
  425. "MenuItem.foreground", table.get("menuText"),
  426. "MenuItem.background", table.get("menu"),
  427. "MenuItem.selectionForeground", table.get("textHighlightText"),
  428. "MenuItem.selectionBackground", table.get("textHighlight"),
  429. "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
  430. "MenuItem.checkIcon", menuItemCheckIcon,
  431. "MenuItem.arrowIcon", menuItemArrowIcon,
  432. // OptionPane.
  433. "OptionPane.windowBindings", new Object[] {
  434. "ESCAPE", "close" },
  435. // ScrollBar.
  436. "ScrollBar.focusInputMap",
  437. new UIDefaults.LazyInputMap(new Object[] {
  438. "RIGHT", "negativeUnitIncrement",
  439. "KP_RIGHT", "negativeUnitIncrement",
  440. "DOWN", "positiveUnitIncrement",
  441. "KP_DOWN", "positiveUnitIncrement",
  442. "PAGE_DOWN", "positiveBlockIncrement",
  443. "ctrl PAGE_DOWN", "positiveBlockIncrement",
  444. "LEFT", "positiveUnitIncrement",
  445. "KP_LEFT", "positiveUnitIncrement",
  446. "UP", "negativeUnitIncrement",
  447. "KP_UP", "negativeUnitIncrement",
  448. "PAGE_UP", "negativeBlockIncrement",
  449. "ctrl PAGE_UP", "negativeBlockIncrement",
  450. "HOME", "minScroll",
  451. "END", "maxScroll"
  452. }),
  453. // ScrollPane.
  454. "ScrollPane.ancestorInputMap",
  455. new UIDefaults.LazyInputMap(new Object[] {
  456. "RIGHT", "unitScrollRight",
  457. "KP_RIGHT", "unitScrollRight",
  458. "DOWN", "unitScrollDown",
  459. "KP_DOWN", "unitScrollDown",
  460. "LEFT", "unitScrollLeft",
  461. "KP_LEFT", "unitScrollLeft",
  462. "UP", "unitScrollUp",
  463. "KP_UP", "unitScrollUp",
  464. "PAGE_UP", "scrollUp",
  465. "PAGE_DOWN", "scrollDown",
  466. "ctrl PAGE_UP", "scrollLeft",
  467. "ctrl PAGE_DOWN", "scrollRight",
  468. "ctrl HOME", "scrollHome",
  469. "ctrl END", "scrollEnd"
  470. }),
  471. // Slider.
  472. "Slider.focusInputMap",
  473. new UIDefaults.LazyInputMap(new Object[] {
  474. "RIGHT", "positiveUnitIncrement",
  475. "KP_RIGHT", "positiveUnitIncrement",
  476. "DOWN", "negativeUnitIncrement",
  477. "KP_DOWN", "negativeUnitIncrement",
  478. "PAGE_DOWN", "negativeBlockIncrement",
  479. "LEFT", "negativeUnitIncrement",
  480. "KP_LEFT", "negativeUnitIncrement",
  481. "UP", "positiveUnitIncrement",
  482. "KP_UP", "positiveUnitIncrement",
  483. "PAGE_UP", "positiveBlockIncrement",
  484. "HOME", "minScroll",
  485. "END", "maxScroll"
  486. }),
  487. "SplitPane.background", table.get("control"),
  488. "SplitPane.highlight", table.get("controllHighlight"),
  489. "SplitPane.shadow", table.get("controlShadow"),
  490. "SplitPane.dividerSize", new Integer(5),
  491. "SplitPane.ancestorInputMap",
  492. new UIDefaults.LazyInputMap(new Object[] {
  493. "UP", "negativeIncrement",
  494. "DOWN", "positiveIncrement",
  495. "LEFT", "negativeIncrement",
  496. "RIGHT", "positiveIncrement",
  497. "KP_UP", "negativeIncrement",
  498. "KP_DOWN", "positiveIncrement",
  499. "KP_LEFT", "negativeIncrement",
  500. "KP_RIGHT", "positiveIncrement",
  501. "HOME", "selectMin",
  502. "END", "selectMax",
  503. "F8", "startResize",
  504. "F6", "toggleFocus"
  505. }),
  506. // TabbedPane
  507. "TabbedPane.focusInputMap",
  508. new UIDefaults.LazyInputMap(new Object[] {
  509. "RIGHT", "navigateRight",
  510. "KP_RIGHT", "navigateRight",
  511. "LEFT", "navigateLeft",
  512. "KP_LEFT", "navigateLeft",
  513. "UP", "navigateUp",
  514. "KP_UP", "navigateUp",
  515. "DOWN", "navigateDown",
  516. "KP_DOWN", "navigateDown",
  517. "ctrl DOWN", "requestFocusForVisibleComponent",
  518. "ctrl KP_DOWN", "requestFocusForVisibleComponent",
  519. }),
  520. "TabbedPane.ancestorInputMap",
  521. new UIDefaults.LazyInputMap(new Object[] {
  522. "ctrl PAGE_DOWN", "navigatePageDown",
  523. "ctrl PAGE_UP", "navigatePageUp",
  524. "ctrl UP", "requestFocus",
  525. "ctrl KP_UP", "requestFocus",
  526. }),
  527. // Table.
  528. "Table.ancestorInputMap",
  529. new UIDefaults.LazyInputMap(new Object[] {
  530. "RIGHT", "selectNextColumn",
  531. "KP_RIGHT", "selectNextColumn",
  532. "LEFT", "selectPreviousColumn",
  533. "KP_LEFT", "selectPreviousColumn",
  534. "DOWN", "selectNextRow",
  535. "KP_DOWN", "selectNextRow",
  536. "UP", "selectPreviousRow",
  537. "KP_UP", "selectPreviousRow",
  538. "shift RIGHT", "selectNextColumnExtendSelection",
  539. "shift KP_RIGHT", "selectNextColumnExtendSelection",
  540. "shift LEFT", "selectPreviousColumnExtendSelection",
  541. "shift KP_LEFT", "selectPreviousColumnExtendSelection",
  542. "shift DOWN", "selectNextRowExtendSelection",
  543. "shift KP_DOWN", "selectNextRowExtendSelection",
  544. "shift UP", "selectPreviousRowExtendSelection",
  545. "shift KP_UP", "selectPreviousRowExtendSelection",
  546. "PAGE_UP", "scrollUpChangeSelection",
  547. "PAGE_DOWN", "scrollDownChangeSelection",
  548. "HOME", "selectFirstColumn",
  549. "END", "selectLastColumn",
  550. "shift PAGE_UP", "scrollUpExtendSelection",
  551. "shift PAGE_DOWN", "scrollDownExtendSelection",
  552. "shift HOME", "selectFirstColumnExtendSelection",
  553. "shift END", "selectLastColumnExtendSelection",
  554. "ctrl PAGE_UP", "scrollLeftChangeSelection",
  555. "ctrl PAGE_DOWN", "scrollRightChangeSelection",
  556. "ctrl HOME", "selectFirstRow",
  557. "ctrl END", "selectLastRow",
  558. "ctrl shift PAGE_UP", "scrollRightExtendSelection",
  559. "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
  560. "ctrl shift HOME", "selectFirstRowExtendSelection",
  561. "ctrl shift END", "selectLastRowExtendSelection",
  562. "TAB", "selectNextColumnCell",
  563. "shift TAB", "selectPreviousColumnCell",
  564. "ENTER", "selectNextRowCell",
  565. "shift ENTER", "selectPreviousRowCell",
  566. "ctrl A", "selectAll",
  567. "ESCAPE", "cancel",
  568. "F2", "startEditing"
  569. }),
  570. // ToolBar.
  571. "ToolBar.ancestorInputMap",
  572. new UIDefaults.LazyInputMap(new Object[] {
  573. "UP", "navigateUp",
  574. "KP_UP", "navigateUp",
  575. "DOWN", "navigateDown",
  576. "KP_DOWN", "navigateDown",
  577. "LEFT", "navigateLeft",
  578. "KP_LEFT", "navigateLeft",
  579. "RIGHT", "navigateRight",
  580. "KP_RIGHT", "navigateRight"
  581. }),
  582. "ToolTip.font", sansSerifPlain12,
  583. "ToolTip.border", toolTipBorder,
  584. "ToolTip.background", table.get("info"),
  585. "ToolTip.foreground", table.get("infoText"),
  586. "ProgressBar.font", dialogPlain12,
  587. "ProgressBar.foreground", table.get("textHighlight"),
  588. "ProgressBar.background", table.get("control"),
  589. "ProgressBar.selectionForeground", table.get("control"),
  590. "ProgressBar.selectionBackground", table.get("textHighlight"),
  591. "ProgressBar.border", progressBarBorder,
  592. "ProgressBar.cellLength", new Integer(7),
  593. "ProgressBar.cellSpacing", new Integer(2),
  594. "Tree.font", dialogPlain12,
  595. "Tree.background", table.get("window"),
  596. "Tree.foreground", table.get("textText"),
  597. "Tree.hash", gray,
  598. "Tree.textForeground", table.get("textText"),
  599. "Tree.textBackground", table.get("window"),
  600. "Tree.selectionForeground", table.get("textHighlightText"),
  601. "Tree.selectionBackground", table.get("textHighlight"),
  602. "Tree.selectionBorderColor", yellow,
  603. "Tree.expandedIcon", treeExpandedIcon,
  604. "Tree.collapsedIcon", treeCollapsedIcon,
  605. "Tree.focusInputMap",
  606. new UIDefaults.LazyInputMap(new Object[] {
  607. "UP", "selectPrevious",
  608. "KP_UP", "selectPrevious",
  609. "shift UP", "selectPreviousExtendSelection",
  610. "shift KP_UP", "selectPreviousExtendSelection",
  611. "DOWN", "selectNext",
  612. "KP_DOWN", "selectNext",
  613. "shift DOWN", "selectNextExtendSelection",
  614. "shift KP_DOWN", "selectNextExtendSelection",
  615. "RIGHT", "selectChild",
  616. "KP_RIGHT", "selectChild",
  617. "LEFT", "selectParent",
  618. "KP_LEFT", "selectParent",
  619. "PAGE_UP", "scrollUpChangeSelection",
  620. "shift PAGE_UP", "scrollUpExtendSelection",
  621. "PAGE_DOWN", "scrollDownChangeSelection",
  622. "shift PAGE_DOWN", "scrollDownExtendSelection",
  623. "HOME", "selectFirst",
  624. "shift HOME", "selectFirstExtendSelection",
  625. "END", "selectLast",
  626. "shift END", "selectLastExtendSelection",
  627. "ENTER", "toggle",
  628. "F2", "startEditing",
  629. "ctrl A", "selectAll",
  630. "ctrl SLASH", "selectAll",
  631. "ctrl BACK_SLASH", "clearSelection",
  632. "ctrl SPACE", "toggleSelectionPreserveAnchor",
  633. "shift SPACE", "extendSelection",
  634. "ctrl HOME", "selectFirstChangeLead",
  635. "ctrl END", "selectLastChangeLead",
  636. "ctrl UP", "selectPreviousChangeLead",
  637. "ctrl KP_UP", "selectPreviousChangeLead",
  638. "ctrl DOWN", "selectNextChangeLead",
  639. "ctrl KP_DOWN", "selectNextChangeLead",
  640. "ctrl PAGE_DOWN", "scrollDownChangeLead",
  641. "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
  642. "ctrl PAGE_UP", "scrollUpChangeLead",
  643. "ctrl shift PAGE_UP", "scrollUpExtendSelection",
  644. "ctrl LEFT", "scrollLeft",
  645. "ctrl KP_LEFT", "scrollLeft",
  646. "ctrl RIGHT", "scrollRight",
  647. "ctrl KP_RIGHT", "scrollRight",
  648. "SPACE", "toggleSelectionPreserveAnchor",
  649. }),
  650. "Tree.ancestorInputMap",
  651. new UIDefaults.LazyInputMap(new Object[] {
  652. "ESCAPE", "cancel"
  653. }),
  654. "FileChooser.newFolderIcon", LookAndFeel.makeIcon(getClass(), "icons/NewFolder.gif"),
  655. "FileChooser.upFolderIcon", LookAndFeel.makeIcon(getClass(), "icons/UpFolder.gif"),
  656. "FileChooser.homeFolderIcon", LookAndFeel.makeIcon(getClass(), "icons/HomeFolder.gif"),
  657. "FileChooser.detailsViewIcon", LookAndFeel.makeIcon(getClass(), "icons/DetailsView.gif"),
  658. "FileChooser.listViewIcon", LookAndFeel.makeIcon(getClass(), "icons/ListView.gif"),
  659. "FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I),
  660. "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N),
  661. "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),
  662. "FileChooser.ancestorInputMap",
  663. new UIDefaults.LazyInputMap(new Object[] {
  664. "ESCAPE", "cancelSelection"
  665. }),
  666. "FileView.directoryIcon", LookAndFeel.makeIcon(getClass(), "icons/Directory.gif"),
  667. "FileView.fileIcon", LookAndFeel.makeIcon(getClass(), "icons/File.gif"),
  668. "FileView.computerIcon", LookAndFeel.makeIcon(getClass(), "icons/Computer.gif"),
  669. "FileView.hardDriveIcon", LookAndFeel.makeIcon(getClass(), "icons/HardDrive.gif"),
  670. "FileView.floppyDriveIcon", LookAndFeel.makeIcon(getClass(), "icons/FloppyDrive.gif"),
  671. "InternalFrame.minimizeIconBackground", table.get("control"),
  672. "InternalFrame.resizeIconHighlight", table.get("controlHighlight"),
  673. "InternalFrame.resizeIconShadow", table.get("controlShadow"),
  674. "InternalFrame.maximizeIcon",
  675. WindowsIconFactory.createFrameMaximizeIcon(),
  676. "InternalFrame.minimizeIcon",
  677. WindowsIconFactory.createFrameMinimizeIcon(),
  678. "InternalFrame.iconifyIcon",
  679. WindowsIconFactory.createFrameIconifyIcon(),
  680. "InternalFrame.closeIcon",
  681. WindowsIconFactory.createFrameCloseIcon(),
  682. "InternalFrame.windowBindings", new Object[] {
  683. "shift ESCAPE", "showSystemMenu",
  684. "ctrl SPACE", "showSystemMenu",
  685. "ESCAPE", "hideSystemMenu"},
  686. // These bindings are only enabled when there is a default
  687. // button set on the rootpane.
  688. "RootPane.defaultButtonWindowKeyBindings", new Object[] {
  689. "ENTER", "press",
  690. "released ENTER", "release",
  691. "ctrl ENTER", "press",
  692. "ctrl released ENTER", "release"
  693. },
  694. };
  695. table.putDefaults(defaults);
  696. }
  697. }