1. /*
  2. * @(#)BasicLookAndFeel.java 1.238 04/03/05
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.basic;
  8. import java.awt.Font;
  9. import java.awt.Color;
  10. import java.awt.SystemColor;
  11. import java.awt.event.*;
  12. import java.awt.Insets;
  13. import java.awt.Component;
  14. import java.awt.Container;
  15. import java.awt.FocusTraversalPolicy;
  16. import java.awt.AWTEvent;
  17. import java.awt.Toolkit;
  18. import java.awt.Point;
  19. import java.net.URL;
  20. import java.io.*;
  21. import java.awt.Dimension;
  22. import java.awt.KeyboardFocusManager;
  23. import java.security.AccessController;
  24. import java.security.PrivilegedAction;
  25. import java.util.*;
  26. import java.lang.reflect.*;
  27. import javax.sound.sampled.*;
  28. import sun.swing.SwingLazyValue;
  29. import javax.swing.LookAndFeel;
  30. import javax.swing.AbstractAction;
  31. import javax.swing.Action;
  32. import javax.swing.ActionMap;
  33. import javax.swing.BorderFactory;
  34. import javax.swing.JComponent;
  35. import javax.swing.ImageIcon;
  36. import javax.swing.UIDefaults;
  37. import javax.swing.UIManager;
  38. import javax.swing.KeyStroke;
  39. import javax.swing.JTextField;
  40. import javax.swing.DefaultListCellRenderer;
  41. import javax.swing.FocusManager;
  42. import javax.swing.LayoutFocusTraversalPolicy;
  43. import javax.swing.SwingUtilities;
  44. import javax.swing.MenuSelectionManager;
  45. import javax.swing.MenuElement;
  46. import javax.swing.border.*;
  47. import javax.swing.plaf.*;
  48. import javax.swing.text.JTextComponent;
  49. import javax.swing.text.DefaultEditorKit;
  50. /**
  51. * Implements the a standard base LookAndFeel class from which
  52. * standard desktop LookAndFeel classes (JLF, Mac, Windows, etc.)
  53. * can be derived. This class cannot be instantiated directly,
  54. * however the UI classes "Basic" defines can be.
  55. * <p>
  56. * <strong>Warning:</strong>
  57. * Serialized objects of this class will not be compatible with
  58. * future Swing releases. The current serialization support is
  59. * appropriate for short term storage or RMI between applications running
  60. * the same version of Swing. As of 1.4, support for long term storage
  61. * of all JavaBeans<sup><font size="-2">TM</font></sup>
  62. * has been added to the <code>java.beans</code> package.
  63. * Please see {@link java.beans.XMLEncoder}.
  64. *
  65. * @version 1.238 03/05/04
  66. * @author unattributed
  67. */
  68. public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable
  69. {
  70. /**
  71. * Whether or not the developer has created a JPopupMenu.
  72. */
  73. static boolean hasPopups;
  74. /**
  75. * Lock used when manipulating clipPlaying.
  76. */
  77. private Object audioLock = new Object();
  78. /**
  79. * The Clip that is currently playing (set in AudioAction).
  80. */
  81. private Clip clipPlaying;
  82. PopupInvocationHelper invocator = null;
  83. public UIDefaults getDefaults() {
  84. UIDefaults table = new UIDefaults();
  85. initClassDefaults(table);
  86. initSystemColorDefaults(table);
  87. initComponentDefaults(table);
  88. return table;
  89. }
  90. /**
  91. * UIManager.setLookAndFeel calls this method before the first call
  92. * (and typically the only call) to getDefaults().
  93. */
  94. public void initialize() {
  95. if (hasPopups) {
  96. createdPopup();
  97. }
  98. }
  99. /**
  100. * UIManager.setLookAndFeel calls this method just
  101. * before we're replaced by a new default look and feel.
  102. */
  103. public void uninitialize() {
  104. Toolkit tk = Toolkit.getDefaultToolkit();
  105. if(invocator != null) {
  106. AccessController.doPrivileged(invocator);
  107. invocator = null;
  108. }
  109. }
  110. /**
  111. * Initialize the uiClassID to BasicComponentUI mapping.
  112. * The JComponent classes define their own uiClassID constants
  113. * (see AbstractComponent.getUIClassID). This table must
  114. * map those constants to a BasicComponentUI class of the
  115. * appropriate type.
  116. *
  117. * @see #getDefaults
  118. */
  119. protected void initClassDefaults(UIDefaults table)
  120. {
  121. final String basicPackageName = "javax.swing.plaf.basic.";
  122. Object[] uiDefaults = {
  123. "ButtonUI", basicPackageName + "BasicButtonUI",
  124. "CheckBoxUI", basicPackageName + "BasicCheckBoxUI",
  125. "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
  126. "FormattedTextFieldUI", basicPackageName + "BasicFormattedTextFieldUI",
  127. "MenuBarUI", basicPackageName + "BasicMenuBarUI",
  128. "MenuUI", basicPackageName + "BasicMenuUI",
  129. "MenuItemUI", basicPackageName + "BasicMenuItemUI",
  130. "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI",
  131. "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI",
  132. "RadioButtonUI", basicPackageName + "BasicRadioButtonUI",
  133. "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI",
  134. "PopupMenuUI", basicPackageName + "BasicPopupMenuUI",
  135. "ProgressBarUI", basicPackageName + "BasicProgressBarUI",
  136. "ScrollBarUI", basicPackageName + "BasicScrollBarUI",
  137. "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI",
  138. "SplitPaneUI", basicPackageName + "BasicSplitPaneUI",
  139. "SliderUI", basicPackageName + "BasicSliderUI",
  140. "SeparatorUI", basicPackageName + "BasicSeparatorUI",
  141. "SpinnerUI", basicPackageName + "BasicSpinnerUI",
  142. "ToolBarSeparatorUI", basicPackageName + "BasicToolBarSeparatorUI",
  143. "PopupMenuSeparatorUI", basicPackageName + "BasicPopupMenuSeparatorUI",
  144. "TabbedPaneUI", basicPackageName + "BasicTabbedPaneUI",
  145. "TextAreaUI", basicPackageName + "BasicTextAreaUI",
  146. "TextFieldUI", basicPackageName + "BasicTextFieldUI",
  147. "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI",
  148. "TextPaneUI", basicPackageName + "BasicTextPaneUI",
  149. "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
  150. "TreeUI", basicPackageName + "BasicTreeUI",
  151. "LabelUI", basicPackageName + "BasicLabelUI",
  152. "ListUI", basicPackageName + "BasicListUI",
  153. "ToolBarUI", basicPackageName + "BasicToolBarUI",
  154. "ToolTipUI", basicPackageName + "BasicToolTipUI",
  155. "ComboBoxUI", basicPackageName + "BasicComboBoxUI",
  156. "TableUI", basicPackageName + "BasicTableUI",
  157. "TableHeaderUI", basicPackageName + "BasicTableHeaderUI",
  158. "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
  159. "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
  160. "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
  161. "OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
  162. "PanelUI", basicPackageName + "BasicPanelUI",
  163. "ViewportUI", basicPackageName + "BasicViewportUI",
  164. "RootPaneUI", basicPackageName + "BasicRootPaneUI",
  165. };
  166. table.putDefaults(uiDefaults);
  167. }
  168. /**
  169. * Load the SystemColors into the defaults table. The keys
  170. * for SystemColor defaults are the same as the names of
  171. * the public fields in SystemColor. If the table is being
  172. * created on a native Windows platform we use the SystemColor
  173. * values, otherwise we create color objects whose values match
  174. * the defaults Windows95 colors.
  175. */
  176. protected void initSystemColorDefaults(UIDefaults table)
  177. {
  178. String[] defaultSystemColors = {
  179. "desktop", "#005C5C", /* Color of the desktop background */
  180. "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
  181. "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
  182. "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
  183. "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
  184. "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
  185. "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
  186. "window", "#FFFFFF", /* Default color for the interior of windows */
  187. "windowBorder", "#000000", /* ??? */
  188. "windowText", "#000000", /* ??? */
  189. "menu", "#C0C0C0", /* Background color for menus */
  190. "menuText", "#000000", /* Text color for menus */
  191. "text", "#C0C0C0", /* Text background color */
  192. "textText", "#000000", /* Text foreground color */
  193. "textHighlight", "#000080", /* Text background color when selected */
  194. "textHighlightText", "#FFFFFF", /* Text color when selected */
  195. "textInactiveText", "#808080", /* Text color when disabled */
  196. "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
  197. "controlText", "#000000", /* Default color for text in controls */
  198. "controlHighlight", "#C0C0C0", /* Specular highlight (opposite of the shadow) */
  199. "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
  200. "controlShadow", "#808080", /* Shadow color for controls */
  201. "controlDkShadow", "#000000", /* Dark shadow color for controls */
  202. "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
  203. "info", "#FFFFE1", /* ??? */
  204. "infoText", "#000000" /* ??? */
  205. };
  206. loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
  207. }
  208. /**
  209. * If this is the native look and feel the initial values for the
  210. * system color properties are the same as the SystemColor constants.
  211. * If not we use the integer color values in the <code>systemColors</code>
  212. * argument.
  213. */
  214. protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)
  215. {
  216. /* PENDING(hmuller) We don't load the system colors below because
  217. * they're not reliable. Hopefully we'll be able to do better in
  218. * a future version of AWT.
  219. */
  220. if (useNative) {
  221. for(int i = 0; i < systemColors.length; i += 2) {
  222. Color color = Color.black;
  223. try {
  224. String name = systemColors[i];
  225. color = (Color)(SystemColor.class.getField(name).get(null));
  226. } catch (Exception e) {
  227. }
  228. table.put(systemColors[i], new ColorUIResource(color));
  229. }
  230. } else {
  231. for(int i = 0; i < systemColors.length; i += 2) {
  232. Color color = Color.black;
  233. try {
  234. color = Color.decode(systemColors[i + 1]);
  235. }
  236. catch(NumberFormatException e) {
  237. e.printStackTrace();
  238. }
  239. table.put(systemColors[i], new ColorUIResource(color));
  240. }
  241. }
  242. }
  243. /**
  244. * Initialize the defaults table with the name of the ResourceBundle
  245. * used for getting localized defaults. Also initialize the default
  246. * locale used when no locale is passed into UIDefaults.get(). The
  247. * default locale should generally not be relied upon. It is here for
  248. * compatability with releases prior to 1.4.
  249. */
  250. private void initResourceBundle(UIDefaults table) {
  251. table.setDefaultLocale( Locale.getDefault() );
  252. table.addResourceBundle( "com.sun.swing.internal.plaf.basic.resources.basic" );
  253. }
  254. protected void initComponentDefaults(UIDefaults table)
  255. {
  256. initResourceBundle(table);
  257. // *** Shared Integers
  258. Integer fiveHundred = new Integer(500);
  259. // *** Shared Longs
  260. Long oneThousand = new Long(1000);
  261. // *** Shared Fonts
  262. Integer twelve = new Integer(12);
  263. Integer fontPlain = new Integer(Font.PLAIN);
  264. Integer fontBold = new Integer(Font.BOLD);
  265. Object dialogPlain12 = new SwingLazyValue(
  266. "javax.swing.plaf.FontUIResource",
  267. null,
  268. new Object[] {"Dialog", fontPlain, twelve});
  269. Object serifPlain12 = new SwingLazyValue(
  270. "javax.swing.plaf.FontUIResource",
  271. null,
  272. new Object[] {"Serif", fontPlain, twelve});
  273. Object sansSerifPlain12 = new SwingLazyValue(
  274. "javax.swing.plaf.FontUIResource",
  275. null,
  276. new Object[] {"SansSerif", fontPlain, twelve});
  277. Object monospacedPlain12 = new SwingLazyValue(
  278. "javax.swing.plaf.FontUIResource",
  279. null,
  280. new Object[] {"MonoSpaced", fontPlain, twelve});
  281. Object dialogBold12 = new SwingLazyValue(
  282. "javax.swing.plaf.FontUIResource",
  283. null,
  284. new Object[] {"Dialog", fontBold, twelve});
  285. // *** Shared Colors
  286. ColorUIResource red = new ColorUIResource(Color.red);
  287. ColorUIResource black = new ColorUIResource(Color.black);
  288. ColorUIResource white = new ColorUIResource(Color.white);
  289. ColorUIResource yellow = new ColorUIResource(Color.yellow);
  290. ColorUIResource gray = new ColorUIResource(Color.gray);
  291. ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
  292. ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
  293. ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224);
  294. Color control = table.getColor("control");
  295. Color controlDkShadow = table.getColor("controlDkShadow");
  296. Color controlHighlight = table.getColor("controlHighlight");
  297. Color controlLtHighlight = table.getColor("controlLtHighlight");
  298. Color controlShadow = table.getColor("controlShadow");
  299. Color controlText = table.getColor("controlText");
  300. Color menu = table.getColor("menu");
  301. Color menuText = table.getColor("menuText");
  302. Color textHighlight = table.getColor("textHighlight");
  303. Color textHighlightText = table.getColor("textHighlightText");
  304. Color textInactiveText = table.getColor("textInactiveText");
  305. Color textText = table.getColor("textText");
  306. Color window = table.getColor("window");
  307. // *** Shared Insets
  308. InsetsUIResource zeroInsets = new InsetsUIResource(0,0,0,0);
  309. InsetsUIResource twoInsets = new InsetsUIResource(2, 2, 2, 2);
  310. // *** Shared Borders
  311. Object marginBorder = new SwingLazyValue(
  312. "javax.swing.plaf.basic.BasicBorders$MarginBorder");
  313. Object etchedBorder = new SwingLazyValue(
  314. "javax.swing.plaf.BorderUIResource",
  315. "getEtchedBorderUIResource");
  316. Object loweredBevelBorder = new SwingLazyValue(
  317. "javax.swing.plaf.BorderUIResource",
  318. "getLoweredBevelBorderUIResource");
  319. Object popupMenuBorder = new SwingLazyValue(
  320. "javax.swing.plaf.basic.BasicBorders",
  321. "getInternalFrameBorder");
  322. Object blackLineBorder = new SwingLazyValue(
  323. "javax.swing.plaf.BorderUIResource",
  324. "getBlackLineBorderUIResource");
  325. Object focusCellHighlightBorder = new SwingLazyValue(
  326. "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
  327. null,
  328. new Object[] {yellow});
  329. Object tableHeaderBorder = new SwingLazyValue(
  330. "javax.swing.plaf.BorderUIResource$BevelBorderUIResource",
  331. null,
  332. new Object[] { new Integer(BevelBorder.RAISED),
  333. controlLtHighlight,
  334. control,
  335. controlDkShadow,
  336. controlShadow });
  337. // *** Button value objects
  338. Object buttonBorder =
  339. new SwingLazyValue(
  340. "javax.swing.plaf.basic.BasicBorders",
  341. "getButtonBorder");
  342. Object buttonToggleBorder =
  343. new SwingLazyValue(
  344. "javax.swing.plaf.basic.BasicBorders",
  345. "getToggleButtonBorder");
  346. Object radioButtonBorder =
  347. new SwingLazyValue(
  348. "javax.swing.plaf.basic.BasicBorders",
  349. "getRadioButtonBorder");
  350. // *** FileChooser / FileView value objects
  351. Object newFolderIcon = LookAndFeel.makeIcon(getClass(), "icons/NewFolder.gif");
  352. Object upFolderIcon = LookAndFeel.makeIcon(getClass(), "icons/UpFolder.gif");
  353. Object homeFolderIcon = LookAndFeel.makeIcon(getClass(), "icons/HomeFolder.gif");
  354. Object detailsViewIcon = LookAndFeel.makeIcon(getClass(), "icons/DetailsView.gif");
  355. Object listViewIcon = LookAndFeel.makeIcon(getClass(), "icons/ListView.gif");
  356. Object directoryIcon = LookAndFeel.makeIcon(getClass(), "icons/Directory.gif");
  357. Object fileIcon = LookAndFeel.makeIcon(getClass(), "icons/File.gif");
  358. Object computerIcon = LookAndFeel.makeIcon(getClass(), "icons/Computer.gif");
  359. Object hardDriveIcon = LookAndFeel.makeIcon(getClass(), "icons/HardDrive.gif");
  360. Object floppyDriveIcon = LookAndFeel.makeIcon(getClass(), "icons/FloppyDrive.gif");
  361. // *** InternalFrame value objects
  362. Object internalFrameBorder = new SwingLazyValue(
  363. "javax.swing.plaf.basic.BasicBorders",
  364. "getInternalFrameBorder");
  365. // *** List value objects
  366. Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
  367. public Object createValue(UIDefaults table) {
  368. return new DefaultListCellRenderer.UIResource();
  369. }
  370. };
  371. // *** Menus value objects
  372. Object menuBarBorder =
  373. new SwingLazyValue(
  374. "javax.swing.plaf.basic.BasicBorders",
  375. "getMenuBarBorder");
  376. Object menuItemCheckIcon =
  377. new SwingLazyValue(
  378. "javax.swing.plaf.basic.BasicIconFactory",
  379. "getMenuItemCheckIcon");
  380. Object menuItemArrowIcon =
  381. new SwingLazyValue(
  382. "javax.swing.plaf.basic.BasicIconFactory",
  383. "getMenuItemArrowIcon");
  384. Object menuArrowIcon =
  385. new SwingLazyValue(
  386. "javax.swing.plaf.basic.BasicIconFactory",
  387. "getMenuArrowIcon");
  388. Object checkBoxIcon =
  389. new SwingLazyValue(
  390. "javax.swing.plaf.basic.BasicIconFactory",
  391. "getCheckBoxIcon");
  392. Object radioButtonIcon =
  393. new SwingLazyValue(
  394. "javax.swing.plaf.basic.BasicIconFactory",
  395. "getRadioButtonIcon");
  396. Object checkBoxMenuItemIcon =
  397. new SwingLazyValue(
  398. "javax.swing.plaf.basic.BasicIconFactory",
  399. "getCheckBoxMenuItemIcon");
  400. Object radioButtonMenuItemIcon =
  401. new SwingLazyValue(
  402. "javax.swing.plaf.basic.BasicIconFactory",
  403. "getRadioButtonMenuItemIcon");
  404. Object menuItemAcceleratorDelimiter = new String("+");
  405. // *** OptionPane value objects
  406. Object optionPaneMinimumSize = new DimensionUIResource(262, 90);
  407. Integer zero = new Integer(0);
  408. Object zeroBorder = new SwingLazyValue(
  409. "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
  410. new Object[] {zero, zero, zero, zero});
  411. Integer ten = new Integer(10);
  412. Object optionPaneBorder = new SwingLazyValue(
  413. "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
  414. new Object[] {ten, ten, twelve, ten});
  415. Object optionPaneButtonAreaBorder = new SwingLazyValue(
  416. "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
  417. new Object[] {new Integer(6), zero, zero, zero});
  418. // *** ProgessBar value objects
  419. Object progressBarBorder =
  420. new SwingLazyValue(
  421. "javax.swing.plaf.basic.BasicBorders",
  422. "getProgressBarBorder");
  423. // ** ScrollBar value objects
  424. Object minimumThumbSize = new DimensionUIResource(8,8);
  425. Object maximumThumbSize = new DimensionUIResource(4096,4096);
  426. // ** Slider value objects
  427. Object sliderFocusInsets = twoInsets;
  428. Object toolBarSeparatorSize = new DimensionUIResource( 10, 10 );
  429. // *** SplitPane value objects
  430. Object splitPaneBorder =
  431. new SwingLazyValue(
  432. "javax.swing.plaf.basic.BasicBorders",
  433. "getSplitPaneBorder");
  434. Object splitPaneDividerBorder =
  435. new SwingLazyValue(
  436. "javax.swing.plaf.basic.BasicBorders",
  437. "getSplitPaneDividerBorder");
  438. // ** TabbedBane value objects
  439. Object tabbedPaneTabInsets = new InsetsUIResource(0, 4, 1, 4);
  440. Object tabbedPaneTabPadInsets = new InsetsUIResource(2, 2, 2, 1);
  441. Object tabbedPaneTabAreaInsets = new InsetsUIResource(3, 2, 0, 2);
  442. Object tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 3, 3);
  443. // *** Text value objects
  444. Object textFieldBorder =
  445. new SwingLazyValue(
  446. "javax.swing.plaf.basic.BasicBorders",
  447. "getTextFieldBorder");
  448. Object editorMargin = new InsetsUIResource(3,3,3,3);
  449. Object caretBlinkRate = fiveHundred;
  450. Integer four = new Integer(4);
  451. Object[] allAuditoryCues = new Object[] {
  452. "CheckBoxMenuItem.commandSound",
  453. "InternalFrame.closeSound",
  454. "InternalFrame.maximizeSound",
  455. "InternalFrame.minimizeSound",
  456. "InternalFrame.restoreDownSound",
  457. "InternalFrame.restoreUpSound",
  458. "MenuItem.commandSound",
  459. "OptionPane.errorSound",
  460. "OptionPane.informationSound",
  461. "OptionPane.questionSound",
  462. "OptionPane.warningSound",
  463. "PopupMenu.popupSound",
  464. "RadioButtonMenuItem.commandSound"};
  465. Object[] noAuditoryCues = new Object[] {"mute"};
  466. // *** Component Defaults
  467. Object[] defaults = {
  468. // *** Auditory Feedback
  469. "AuditoryCues.cueList", allAuditoryCues,
  470. "AuditoryCues.allAuditoryCues", allAuditoryCues,
  471. "AuditoryCues.noAuditoryCues", noAuditoryCues,
  472. // this key defines which of the various cues to render.
  473. // L&Fs that want auditory feedback NEED to override playList.
  474. "AuditoryCues.playList", null,
  475. // *** Buttons
  476. "Button.defaultButtonFollowsFocus", Boolean.TRUE,
  477. "Button.font", dialogPlain12,
  478. "Button.background", control,
  479. "Button.foreground", controlText,
  480. "Button.shadow", controlShadow,
  481. "Button.darkShadow", controlDkShadow,
  482. "Button.light", controlHighlight,
  483. "Button.highlight", controlLtHighlight,
  484. "Button.border", buttonBorder,
  485. "Button.margin", new InsetsUIResource(2, 14, 2, 14),
  486. "Button.textIconGap", four,
  487. "Button.textShiftOffset", zero,
  488. "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
  489. "SPACE", "pressed",
  490. "released SPACE", "released",
  491. "ENTER", "pressed",
  492. "released ENTER", "released"
  493. }),
  494. "ToggleButton.font", dialogPlain12,
  495. "ToggleButton.background", control,
  496. "ToggleButton.foreground", controlText,
  497. "ToggleButton.shadow", controlShadow,
  498. "ToggleButton.darkShadow", controlDkShadow,
  499. "ToggleButton.light", controlHighlight,
  500. "ToggleButton.highlight", controlLtHighlight,
  501. "ToggleButton.border", buttonToggleBorder,
  502. "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
  503. "ToggleButton.textIconGap", four,
  504. "ToggleButton.textShiftOffset", zero,
  505. "ToggleButton.focusInputMap",
  506. new UIDefaults.LazyInputMap(new Object[] {
  507. "SPACE", "pressed",
  508. "released SPACE", "released"
  509. }),
  510. "RadioButton.font", dialogPlain12,
  511. "RadioButton.background", control,
  512. "RadioButton.foreground", controlText,
  513. "RadioButton.shadow", controlShadow,
  514. "RadioButton.darkShadow", controlDkShadow,
  515. "RadioButton.light", controlHighlight,
  516. "RadioButton.highlight", controlLtHighlight,
  517. "RadioButton.border", radioButtonBorder,
  518. "RadioButton.margin", twoInsets,
  519. "RadioButton.textIconGap", four,
  520. "RadioButton.textShiftOffset", zero,
  521. "RadioButton.icon", radioButtonIcon,
  522. "RadioButton.focusInputMap",
  523. new UIDefaults.LazyInputMap(new Object[] {
  524. "SPACE", "pressed",
  525. "released SPACE", "released",
  526. "RETURN", "pressed"
  527. }),
  528. "CheckBox.font", dialogPlain12,
  529. "CheckBox.background", control,
  530. "CheckBox.foreground", controlText,
  531. "CheckBox.border", radioButtonBorder,
  532. "CheckBox.margin", twoInsets,
  533. "CheckBox.textIconGap", four,
  534. "CheckBox.textShiftOffset", zero,
  535. "CheckBox.icon", checkBoxIcon,
  536. "CheckBox.focusInputMap",
  537. new UIDefaults.LazyInputMap(new Object[] {
  538. "SPACE", "pressed",
  539. "released SPACE", "released"
  540. }),
  541. "FileChooser.useSystemExtensionHiding", Boolean.FALSE,
  542. // *** ColorChooser
  543. "ColorChooser.font", dialogPlain12,
  544. "ColorChooser.background", control,
  545. "ColorChooser.foreground", controlText,
  546. "ColorChooser.swatchesSwatchSize", new Dimension(10, 10),
  547. "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10),
  548. "ColorChooser.swatchesDefaultRecentColor", control,
  549. // *** ComboBox
  550. "ComboBox.font", sansSerifPlain12,
  551. "ComboBox.background", window,
  552. "ComboBox.foreground", textText,
  553. "ComboBox.buttonBackground", control,
  554. "ComboBox.buttonShadow", controlShadow,
  555. "ComboBox.buttonDarkShadow", controlDkShadow,
  556. "ComboBox.buttonHighlight", controlLtHighlight,
  557. "ComboBox.selectionBackground", textHighlight,
  558. "ComboBox.selectionForeground", textHighlightText,
  559. "ComboBox.disabledBackground", control,
  560. "ComboBox.disabledForeground", textInactiveText,
  561. "ComboBox.timeFactor", oneThousand,
  562. "ComboBox.ancestorInputMap",
  563. new UIDefaults.LazyInputMap(new Object[] {
  564. "ESCAPE", "hidePopup",
  565. "PAGE_UP", "pageUpPassThrough",
  566. "PAGE_DOWN", "pageDownPassThrough",
  567. "HOME", "homePassThrough",
  568. "END", "endPassThrough",
  569. "ENTER", "enterPressed"
  570. }),
  571. // *** FileChooser
  572. "FileChooser.newFolderIcon", newFolderIcon,
  573. "FileChooser.upFolderIcon", upFolderIcon,
  574. "FileChooser.homeFolderIcon", homeFolderIcon,
  575. "FileChooser.detailsViewIcon", detailsViewIcon,
  576. "FileChooser.listViewIcon", listViewIcon,
  577. "FileChooser.readOnly", Boolean.FALSE,
  578. "FileChooser.usesSingleFilePane", Boolean.FALSE,
  579. "FileChooser.ancestorInputMap",
  580. new UIDefaults.LazyInputMap(new Object[] {
  581. "ESCAPE", "cancelSelection",
  582. "F5", "refresh",
  583. }),
  584. "FileView.directoryIcon", directoryIcon,
  585. "FileView.fileIcon", fileIcon,
  586. "FileView.computerIcon", computerIcon,
  587. "FileView.hardDriveIcon", hardDriveIcon,
  588. "FileView.floppyDriveIcon", floppyDriveIcon,
  589. // *** InternalFrame
  590. "InternalFrame.titleFont", dialogBold12,
  591. "InternalFrame.borderColor", control,
  592. "InternalFrame.borderShadow", controlShadow,
  593. "InternalFrame.borderDarkShadow", controlDkShadow,
  594. "InternalFrame.borderHighlight", controlLtHighlight,
  595. "InternalFrame.borderLight", controlHighlight,
  596. "InternalFrame.border", internalFrameBorder,
  597. "InternalFrame.icon", LookAndFeel.makeIcon(BasicLookAndFeel.class, "icons/JavaCup16.png"),
  598. /* Default frame icons are undefined for Basic. */
  599. "InternalFrame.maximizeIcon",
  600. new SwingLazyValue(
  601. "javax.swing.plaf.basic.BasicIconFactory",
  602. "createEmptyFrameIcon"),
  603. "InternalFrame.minimizeIcon",
  604. new SwingLazyValue(
  605. "javax.swing.plaf.basic.BasicIconFactory",
  606. "createEmptyFrameIcon"),
  607. "InternalFrame.iconifyIcon",
  608. new SwingLazyValue(
  609. "javax.swing.plaf.basic.BasicIconFactory",
  610. "createEmptyFrameIcon"),
  611. "InternalFrame.closeIcon",
  612. new SwingLazyValue(
  613. "javax.swing.plaf.basic.BasicIconFactory",
  614. "createEmptyFrameIcon"),
  615. // InternalFrame Auditory Cue Mappings
  616. "InternalFrame.closeSound", null,
  617. "InternalFrame.maximizeSound", null,
  618. "InternalFrame.minimizeSound", null,
  619. "InternalFrame.restoreDownSound", null,
  620. "InternalFrame.restoreUpSound", null,
  621. "InternalFrame.activeTitleBackground", table.get("activeCaption"),
  622. "InternalFrame.activeTitleForeground", table.get("activeCaptionText"),
  623. "InternalFrame.inactiveTitleBackground", table.get("inactiveCaption"),
  624. "InternalFrame.inactiveTitleForeground", table.get("inactiveCaptionText"),
  625. "InternalFrame.windowBindings", new Object[] {
  626. "shift ESCAPE", "showSystemMenu",
  627. "ctrl SPACE", "showSystemMenu",
  628. "ESCAPE", "hideSystemMenu"},
  629. "DesktopIcon.border", internalFrameBorder,
  630. "Desktop.background", table.get("desktop"),
  631. "Desktop.ancestorInputMap",
  632. new UIDefaults.LazyInputMap(new Object[] {
  633. "ctrl F5", "restore",
  634. "ctrl F4", "close",
  635. "ctrl F7", "move",
  636. "ctrl F8", "resize",
  637. "RIGHT", "right",
  638. "KP_RIGHT", "right",
  639. "shift RIGHT", "shrinkRight",
  640. "shift KP_RIGHT", "shrinkRight",
  641. "LEFT", "left",
  642. "KP_LEFT", "left",
  643. "shift LEFT", "shrinkLeft",
  644. "shift KP_LEFT", "shrinkLeft",
  645. "UP", "up",
  646. "KP_UP", "up",
  647. "shift UP", "shrinkUp",
  648. "shift KP_UP", "shrinkUp",
  649. "DOWN", "down",
  650. "KP_DOWN", "down",
  651. "shift DOWN", "shrinkDown",
  652. "shift KP_DOWN", "shrinkDown",
  653. "ESCAPE", "escape",
  654. "ctrl F9", "minimize",
  655. "ctrl F10", "maximize",
  656. "ctrl F6", "selectNextFrame",
  657. "ctrl TAB", "selectNextFrame",
  658. "ctrl alt F6", "selectNextFrame",
  659. "shift ctrl alt F6", "selectPreviousFrame",
  660. "ctrl F12", "navigateNext",
  661. "shift ctrl F12", "navigatePrevious"
  662. }),
  663. // *** Label
  664. "Label.font", dialogPlain12,
  665. "Label.background", control,
  666. "Label.foreground", controlText,
  667. "Label.disabledForeground", white,
  668. "Label.disabledShadow", controlShadow,
  669. "Label.border", null,
  670. // *** List
  671. "List.font", dialogPlain12,
  672. "List.background", window,
  673. "List.foreground", textText,
  674. "List.selectionBackground", textHighlight,
  675. "List.selectionForeground", textHighlightText,
  676. "List.focusCellHighlightBorder", focusCellHighlightBorder,
  677. "List.border", null,
  678. "List.cellRenderer", listCellRendererActiveValue,
  679. "List.timeFactor", oneThousand,
  680. "List.focusInputMap",
  681. new UIDefaults.LazyInputMap(new Object[] {
  682. "ctrl C", "copy",
  683. "ctrl V", "paste",
  684. "ctrl X", "cut",
  685. "COPY", "copy",
  686. "PASTE", "paste",
  687. "CUT", "cut",
  688. "UP", "selectPreviousRow",
  689. "KP_UP", "selectPreviousRow",
  690. "shift UP", "selectPreviousRowExtendSelection",
  691. "shift KP_UP", "selectPreviousRowExtendSelection",
  692. "ctrl shift UP", "selectPreviousRowExtendSelection",
  693. "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
  694. "ctrl UP", "selectPreviousRowChangeLead",
  695. "ctrl KP_UP", "selectPreviousRowChangeLead",
  696. "DOWN", "selectNextRow",
  697. "KP_DOWN", "selectNextRow",
  698. "shift DOWN", "selectNextRowExtendSelection",
  699. "shift KP_DOWN", "selectNextRowExtendSelection",
  700. "ctrl shift DOWN", "selectNextRowExtendSelection",
  701. "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
  702. "ctrl DOWN", "selectNextRowChangeLead",
  703. "ctrl KP_DOWN", "selectNextRowChangeLead",
  704. "LEFT", "selectPreviousColumn",
  705. "KP_LEFT", "selectPreviousColumn",
  706. "shift LEFT", "selectPreviousColumnExtendSelection",
  707. "shift KP_LEFT", "selectPreviousColumnExtendSelection",
  708. "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
  709. "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
  710. "ctrl LEFT", "selectPreviousColumnChangeLead",
  711. "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
  712. "RIGHT", "selectNextColumn",
  713. "KP_RIGHT", "selectNextColumn",
  714. "shift RIGHT", "selectNextColumnExtendSelection",
  715. "shift KP_RIGHT", "selectNextColumnExtendSelection",
  716. "ctrl shift RIGHT", "selectNextColumnExtendSelection",
  717. "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
  718. "ctrl RIGHT", "selectNextColumnChangeLead",
  719. "ctrl KP_RIGHT", "selectNextColumnChangeLead",
  720. "HOME", "selectFirstRow",
  721. "shift HOME", "selectFirstRowExtendSelection",
  722. "ctrl shift HOME", "selectFirstRowExtendSelection",
  723. "ctrl HOME", "selectFirstRowChangeLead",
  724. "END", "selectLastRow",
  725. "shift END", "selectLastRowExtendSelection",
  726. "ctrl shift END", "selectLastRowExtendSelection",
  727. "ctrl END", "selectLastRowChangeLead",
  728. "PAGE_UP", "scrollUp",
  729. "shift PAGE_UP", "scrollUpExtendSelection",
  730. "ctrl shift PAGE_UP", "scrollUpExtendSelection",
  731. "ctrl PAGE_UP", "scrollUpChangeLead",
  732. "PAGE_DOWN", "scrollDown",
  733. "shift PAGE_DOWN", "scrollDownExtendSelection",
  734. "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
  735. "ctrl PAGE_DOWN", "scrollDownChangeLead",
  736. "ctrl A", "selectAll",
  737. "ctrl SLASH", "selectAll",
  738. "ctrl BACK_SLASH", "clearSelection",
  739. "SPACE", "addToSelection",
  740. "ctrl SPACE", "toggleAndAnchor",
  741. "shift SPACE", "extendTo",
  742. "ctrl shift SPACE", "moveSelectionTo"
  743. }),
  744. "List.focusInputMap.RightToLeft",
  745. new UIDefaults.LazyInputMap(new Object[] {
  746. "LEFT", "selectNextColumn",
  747. "KP_LEFT", "selectNextColumn",
  748. "shift LEFT", "selectNextColumnExtendSelection",
  749. "shift KP_LEFT", "selectNextColumnExtendSelection",
  750. "ctrl shift LEFT", "selectNextColumnExtendSelection",
  751. "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
  752. "ctrl LEFT", "selectNextColumnChangeLead",
  753. "ctrl KP_LEFT", "selectNextColumnChangeLead",
  754. "RIGHT", "selectPreviousColumn",
  755. "KP_RIGHT", "selectPreviousColumn",
  756. "shift RIGHT", "selectPreviousColumnExtendSelection",
  757. "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
  758. "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
  759. "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
  760. "ctrl RIGHT", "selectPreviousColumnChangeLead",
  761. "ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
  762. }),
  763. // *** Menus
  764. "MenuBar.font", dialogPlain12,
  765. "MenuBar.background", menu,
  766. "MenuBar.foreground", menuText,
  767. "MenuBar.shadow", controlShadow,
  768. "MenuBar.highlight", controlLtHighlight,
  769. "MenuBar.border", menuBarBorder,
  770. "MenuBar.windowBindings", new Object[] {
  771. "F10", "takeFocus" },
  772. "MenuItem.font", dialogPlain12,
  773. "MenuItem.acceleratorFont", dialogPlain12,
  774. "MenuItem.background", menu,
  775. "MenuItem.foreground", menuText,
  776. "MenuItem.selectionForeground", textHighlightText,
  777. "MenuItem.selectionBackground", textHighlight,
  778. "MenuItem.disabledForeground", null,
  779. "MenuItem.acceleratorForeground", menuText,
  780. "MenuItem.acceleratorSelectionForeground", textHighlightText,
  781. "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
  782. "MenuItem.border", marginBorder,
  783. "MenuItem.borderPainted", Boolean.FALSE,
  784. "MenuItem.margin", twoInsets,
  785. "MenuItem.checkIcon", menuItemCheckIcon,
  786. "MenuItem.arrowIcon", menuItemArrowIcon,
  787. "MenuItem.commandSound", null,
  788. "RadioButtonMenuItem.font", dialogPlain12,
  789. "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
  790. "RadioButtonMenuItem.background", menu,
  791. "RadioButtonMenuItem.foreground", menuText,
  792. "RadioButtonMenuItem.selectionForeground", textHighlightText,
  793. "RadioButtonMenuItem.selectionBackground", textHighlight,
  794. "RadioButtonMenuItem.disabledForeground", null,
  795. "RadioButtonMenuItem.acceleratorForeground", menuText,
  796. "RadioButtonMenuItem.acceleratorSelectionForeground", textHighlightText,
  797. "RadioButtonMenuItem.border", marginBorder,
  798. "RadioButtonMenuItem.borderPainted", Boolean.FALSE,
  799. "RadioButtonMenuItem.margin", twoInsets,
  800. "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon,
  801. "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
  802. "RadioButtonMenuItem.commandSound", null,
  803. "CheckBoxMenuItem.font", dialogPlain12,
  804. "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
  805. "CheckBoxMenuItem.background", menu,
  806. "CheckBoxMenuItem.foreground", menuText,
  807. "CheckBoxMenuItem.selectionForeground", textHighlightText,
  808. "CheckBoxMenuItem.selectionBackground", textHighlight,
  809. "CheckBoxMenuItem.disabledForeground", null,
  810. "CheckBoxMenuItem.acceleratorForeground", menuText,
  811. "CheckBoxMenuItem.acceleratorSelectionForeground", textHighlightText,
  812. "CheckBoxMenuItem.border", marginBorder,
  813. "CheckBoxMenuItem.borderPainted", Boolean.FALSE,
  814. "CheckBoxMenuItem.margin", twoInsets,
  815. "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon,
  816. "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
  817. "CheckBoxMenuItem.commandSound", null,
  818. "Menu.font", dialogPlain12,
  819. "Menu.acceleratorFont", dialogPlain12,
  820. "Menu.background", menu,
  821. "Menu.foreground", menuText,
  822. "Menu.selectionForeground", textHighlightText,
  823. "Menu.selectionBackground", textHighlight,
  824. "Menu.disabledForeground", null,
  825. "Menu.acceleratorForeground", menuText,
  826. "Menu.acceleratorSelectionForeground", textHighlightText,
  827. "Menu.border", marginBorder,
  828. "Menu.borderPainted", Boolean.FALSE,
  829. "Menu.margin", twoInsets,
  830. "Menu.checkIcon", menuItemCheckIcon,
  831. "Menu.arrowIcon", menuArrowIcon,
  832. "Menu.menuPopupOffsetX", new Integer(0),
  833. "Menu.menuPopupOffsetY", new Integer(0),
  834. "Menu.submenuPopupOffsetX", new Integer(0),
  835. "Menu.submenuPopupOffsetY", new Integer(0),
  836. "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
  837. "Menu.crossMenuMnemonic", Boolean.TRUE,
  838. // PopupMenu
  839. "PopupMenu.font", dialogPlain12,
  840. "PopupMenu.background", menu,
  841. "PopupMenu.foreground", menuText,
  842. "PopupMenu.border", popupMenuBorder,
  843. // Internal Frame Auditory Cue Mappings
  844. "PopupMenu.popupSound", null,
  845. // These window InputMap bindings are used when the Menu is
  846. // selected.
  847. "PopupMenu.selectedWindowInputMapBindings", new Object[] {
  848. "ESCAPE", "cancel",
  849. "DOWN", "selectNext",
  850. "KP_DOWN", "selectNext",
  851. "UP", "selectPrevious",
  852. "KP_UP", "selectPrevious",
  853. "LEFT", "selectParent",
  854. "KP_LEFT", "selectParent",
  855. "RIGHT", "selectChild",
  856. "KP_RIGHT", "selectChild",
  857. "ENTER", "return",
  858. "SPACE", "return"
  859. },
  860. "PopupMenu.selectedWindowInputMapBindings.RightToLeft", new Object[] {
  861. "LEFT", "selectChild",
  862. "KP_LEFT", "selectChild",
  863. "RIGHT", "selectParent",
  864. "KP_RIGHT", "selectParent",
  865. },
  866. "PopupMenu.consumeEventOnClose", Boolean.FALSE,
  867. // *** OptionPane
  868. // You can additionaly define OptionPane.messageFont which will
  869. // dictate the fonts used for the message, and
  870. // OptionPane.buttonFont, which defines the font for the buttons.
  871. "OptionPane.font", dialogPlain12,
  872. "OptionPane.background", control,
  873. "OptionPane.foreground", controlText,
  874. "OptionPane.messageForeground", controlText,
  875. "OptionPane.border", optionPaneBorder,
  876. "OptionPane.messageAreaBorder", zeroBorder,
  877. "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
  878. "OptionPane.minimumSize", optionPaneMinimumSize,
  879. "OptionPane.errorIcon", LookAndFeel.makeIcon(getClass(), "icons/Error.gif"),
  880. "OptionPane.informationIcon", LookAndFeel.makeIcon(getClass(), "icons/Inform.gif"),
  881. "OptionPane.warningIcon", LookAndFeel.makeIcon(getClass(), "icons/Warn.gif"),
  882. "OptionPane.questionIcon", LookAndFeel.makeIcon(getClass(), "icons/Question.gif"),
  883. "OptionPane.windowBindings", new Object[] {
  884. "ESCAPE", "close" },
  885. // OptionPane Auditory Cue Mappings
  886. "OptionPane.errorSound", null,
  887. "OptionPane.informationSound", null, // Info and Plain
  888. "OptionPane.questionSound", null,
  889. "OptionPane.warningSound", null,
  890. "OptionPane.buttonClickThreshhold", fiveHundred,
  891. // *** Panel
  892. "Panel.font", dialogPlain12,
  893. "Panel.background", control,
  894. "Panel.foreground", textText,
  895. // *** ProgressBar
  896. "ProgressBar.font", dialogPlain12,
  897. "ProgressBar.foreground", textHighlight,
  898. "ProgressBar.background", control,
  899. "ProgressBar.selectionForeground", control,
  900. "ProgressBar.selectionBackground", textHighlight,
  901. "ProgressBar.border", progressBarBorder,
  902. "ProgressBar.cellLength", new Integer(1),
  903. "ProgressBar.cellSpacing", zero,
  904. "ProgressBar.repaintInterval", new Integer(50),
  905. "ProgressBar.cycleTime", new Integer(3000),
  906. "ProgressBar.horizontalSize", new DimensionUIResource(146, 12),
  907. "ProgressBar.verticalSize", new DimensionUIResource(12, 146),
  908. // *** Separator
  909. "Separator.shadow", controlShadow, // DEPRECATED - DO NOT USE!
  910. "Separator.highlight", controlLtHighlight, // DEPRECATED - DO NOT USE!
  911. "Separator.background", controlLtHighlight,
  912. "Separator.foreground", controlShadow,
  913. // *** ScrollBar/ScrollPane/Viewport
  914. "ScrollBar.background", scrollBarTrack,
  915. "ScrollBar.foreground", control,
  916. "ScrollBar.track", table.get("scrollbar"),
  917. "ScrollBar.trackHighlight", controlDkShadow,
  918. "ScrollBar.thumb", control,
  919. "ScrollBar.thumbHighlight", controlLtHighlight,
  920. "ScrollBar.thumbDarkShadow", controlDkShadow,
  921. "ScrollBar.thumbShadow", controlShadow,
  922. "ScrollBar.border", null,
  923. "ScrollBar.minimumThumbSize", minimumThumbSize,
  924. "ScrollBar.maximumThumbSize", maximumThumbSize,
  925. "ScrollBar.ancestorInputMap",
  926. new UIDefaults.LazyInputMap(new Object[] {
  927. "RIGHT", "positiveUnitIncrement",
  928. "KP_RIGHT", "positiveUnitIncrement",
  929. "DOWN", "positiveUnitIncrement",
  930. "KP_DOWN", "positiveUnitIncrement",
  931. "PAGE_DOWN", "positiveBlockIncrement",
  932. "LEFT", "negativeUnitIncrement",
  933. "KP_LEFT", "negativeUnitIncrement",
  934. "UP", "negativeUnitIncrement",
  935. "KP_UP", "negativeUnitIncrement",
  936. "PAGE_UP", "negativeBlockIncrement",
  937. "HOME", "minScroll",
  938. "END", "maxScroll"
  939. }),
  940. "ScrollBar.ancestorInputMap.RightToLeft",
  941. new UIDefaults.LazyInputMap(new Object[] {
  942. "RIGHT", "negativeUnitIncrement",
  943. "KP_RIGHT", "negativeUnitIncrement",
  944. "LEFT", "positiveUnitIncrement",
  945. "KP_LEFT", "positiveUnitIncrement",
  946. }),
  947. "ScrollBar.width", new Integer(16),
  948. "ScrollPane.font", dialogPlain12,
  949. "ScrollPane.background", control,
  950. "ScrollPane.foreground", controlText,
  951. "ScrollPane.border", textFieldBorder,
  952. "ScrollPane.viewportBorder", null,
  953. "ScrollPane.ancestorInputMap",
  954. new UIDefaults.LazyInputMap(new Object[] {
  955. "RIGHT", "unitScrollRight",
  956. "KP_RIGHT", "unitScrollRight",
  957. "DOWN", "unitScrollDown",
  958. "KP_DOWN", "unitScrollDown",
  959. "LEFT", "unitScrollLeft",
  960. "KP_LEFT", "unitScrollLeft",
  961. "UP", "unitScrollUp",
  962. "KP_UP", "unitScrollUp",
  963. "PAGE_UP", "scrollUp",
  964. "PAGE_DOWN", "scrollDown",
  965. "ctrl PAGE_UP", "scrollLeft",
  966. "ctrl PAGE_DOWN", "scrollRight",
  967. "ctrl HOME", "scrollHome",
  968. "ctrl END", "scrollEnd"
  969. }),
  970. "ScrollPane.ancestorInputMap.RightToLeft",
  971. new UIDefaults.LazyInputMap(new Object[] {
  972. "ctrl PAGE_UP", "scrollRight",
  973. "ctrl PAGE_DOWN", "scrollLeft",
  974. }),
  975. "Viewport.font", dialogPlain12,
  976. "Viewport.background", control,
  977. "Viewport.foreground", textText,
  978. // *** Slider
  979. "Slider.foreground", control,
  980. "Slider.background", control,
  981. "Slider.highlight", controlLtHighlight,
  982. "Slider.tickColor", Color.black,
  983. "Slider.shadow", controlShadow,
  984. "Slider.focus", controlDkShadow,
  985. "Slider.border", null,
  986. "Slider.horizontalSize", new Dimension(200, 21),
  987. "Slider.verticalSize", new Dimension(21, 200),
  988. "Slider.minimumHorizontalSize", new Dimension(36, 21),
  989. "Slider.minimumVerticalSize", new Dimension(21, 36),
  990. "Slider.focusInsets", sliderFocusInsets,
  991. "Slider.focusInputMap",
  992. new UIDefaults.LazyInputMap(new Object[] {
  993. "RIGHT", "positiveUnitIncrement",
  994. "KP_RIGHT", "positiveUnitIncrement",
  995. "DOWN", "negativeUnitIncrement",
  996. "KP_DOWN", "negativeUnitIncrement",
  997. "PAGE_DOWN", "negativeBlockIncrement",
  998. "LEFT", "negativeUnitIncrement",
  999. "KP_LEFT", "negativeUnitIncrement",
  1000. "UP", "positiveUnitIncrement",
  1001. "KP_UP", "positiveUnitIncrement",
  1002. "PAGE_UP", "positiveBlockIncrement",
  1003. "HOME", "minScroll",
  1004. "END", "maxScroll"
  1005. }),
  1006. "Slider.focusInputMap.RightToLeft",
  1007. new UIDefaults.LazyInputMap(new Object[] {
  1008. "RIGHT", "negativeUnitIncrement",
  1009. "KP_RIGHT", "negativeUnitIncrement",
  1010. "LEFT", "positiveUnitIncrement",
  1011. "KP_LEFT", "positiveUnitIncrement",
  1012. }),
  1013. // *** Spinner
  1014. "Spinner.font", monospacedPlain12,
  1015. "Spinner.background", control,
  1016. "Spinner.foreground", control,
  1017. "Spinner.border", textFieldBorder,
  1018. "Spinner.arrowButtonBorder", null,
  1019. "Spinner.arrowButtonInsets", null,
  1020. "Spinner.arrowButtonSize", new Dimension(16, 5),
  1021. "Spinner.ancestorInputMap",
  1022. new UIDefaults.LazyInputMap(new Object[] {
  1023. "UP", "increment",
  1024. "KP_UP", "increment",
  1025. "DOWN", "decrement",
  1026. "KP_DOWN", "decrement",
  1027. }),
  1028. "Spinner.editorBorderPainted", Boolean.FALSE,
  1029. // *** SplitPane
  1030. "SplitPane.background", control,
  1031. "SplitPane.highlight", controlLtHighlight,
  1032. "SplitPane.shadow", controlShadow,
  1033. "SplitPane.darkShadow", controlDkShadow,
  1034. "SplitPane.border", splitPaneBorder,
  1035. "SplitPane.dividerSize", new Integer(7),
  1036. "SplitPaneDivider.border", splitPaneDividerBorder,
  1037. "SplitPaneDivider.draggingColor", darkGray,
  1038. "SplitPane.ancestorInputMap",
  1039. new UIDefaults.LazyInputMap(new Object[] {
  1040. "UP", "negativeIncrement",
  1041. "DOWN", "positiveIncrement",
  1042. "LEFT", "negativeIncrement",
  1043. "RIGHT", "positiveIncrement",
  1044. "KP_UP", "negativeIncrement",
  1045. "KP_DOWN", "positiveIncrement",
  1046. "KP_LEFT", "negativeIncrement",
  1047. "KP_RIGHT", "positiveIncrement",
  1048. "HOME", "selectMin",
  1049. "END", "selectMax",
  1050. "F8", "startResize",
  1051. "F6", "toggleFocus",
  1052. "ctrl TAB", "focusOutForward",
  1053. "ctrl shift TAB", "focusOutBackward"
  1054. }),
  1055. // *** TabbedPane
  1056. "TabbedPane.font", dialogPlain12,
  1057. "TabbedPane.background", control,
  1058. "TabbedPane.foreground", controlText,
  1059. "TabbedPane.highlight", controlLtHighlight,
  1060. "TabbedPane.light", controlHighlight,
  1061. "TabbedPane.shadow", controlShadow,
  1062. "TabbedPane.darkShadow", controlDkShadow,
  1063. "TabbedPane.selected", null,
  1064. "TabbedPane.focus", controlText,
  1065. "TabbedPane.textIconGap", four,
  1066. // Causes tabs to be painted on top of the content area border.
  1067. // The amount of overlap is then controlled by tabAreaInsets.bottom,
  1068. // which is zero by default
  1069. "TabbedPane.tabsOverlapBorder", Boolean.FALSE,
  1070. "TabbedPane.tabInsets", tabbedPaneTabInsets,
  1071. "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
  1072. "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
  1073. "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
  1074. "TabbedPane.tabRunOverlay", new Integer(2),
  1075. "TabbedPane.tabsOpaque", Boolean.TRUE,
  1076. "TabbedPane.contentOpaque", Boolean.TRUE,
  1077. "TabbedPane.focusInputMap",
  1078. new UIDefaults.LazyInputMap(new Object[] {
  1079. "RIGHT", "navigateRight",
  1080. "KP_RIGHT", "navigateRight",
  1081. "LEFT", "navigateLeft",
  1082. "KP_LEFT", "navigateLeft",
  1083. "UP", "navigateUp",
  1084. "KP_UP", "navigateUp",
  1085. "DOWN", "navigateDown",
  1086. "KP_DOWN", "navigateDown",
  1087. "ctrl DOWN", "requestFocusForVisibleComponent",
  1088. "ctrl KP_DOWN", "requestFocusForVisibleComponent",
  1089. }),
  1090. "TabbedPane.ancestorInputMap",
  1091. new UIDefaults.LazyInputMap(new Object[] {
  1092. "ctrl PAGE_DOWN", "navigatePageDown",
  1093. "ctrl PAGE_UP", "navigatePageUp",
  1094. "ctrl UP", "requestFocus",
  1095. "ctrl KP_UP", "requestFocus",
  1096. }),
  1097. // *** Table
  1098. "Table.font", dialogPlain12,
  1099. "Table.foreground", controlText, // cell text color
  1100. "Table.background", window, // cell background color
  1101. "Table.selectionForeground", textHighlightText,
  1102. "Table.selectionBackground", textHighlight,
  1103. "Table.gridColor", gray, // grid line color
  1104. "Table.focusCellBackground", window,
  1105. "Table.focusCellForeground", controlText,
  1106. "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  1107. "Table.scrollPaneBorder", loweredBevelBorder,
  1108. "Table.ancestorInputMap",
  1109. new UIDefaults.LazyInputMap(new Object[] {
  1110. "ctrl C", "copy",
  1111. "ctrl V", "paste",
  1112. "ctrl X", "cut",
  1113. "COPY", "copy",
  1114. "PASTE", "paste",
  1115. "CUT", "cut",
  1116. "RIGHT", "selectNextColumn",
  1117. "KP_RIGHT", "selectNextColumn",
  1118. "shift RIGHT", "selectNextColumnExtendSelection",
  1119. "shift KP_RIGHT", "selectNextColumnExtendSelection",
  1120. "ctrl shift RIGHT", "selectNextColumnExtendSelection",
  1121. "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
  1122. "ctrl RIGHT", "selectNextColumnChangeLead",
  1123. "ctrl KP_RIGHT", "selectNextColumnChangeLead",
  1124. "LEFT", "selectPreviousColumn",
  1125. "KP_LEFT", "selectPreviousColumn",
  1126. "shift LEFT", "selectPreviousColumnExtendSelection",
  1127. "shift KP_LEFT", "selectPreviousColumnExtendSelection",
  1128. "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
  1129. "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
  1130. "ctrl LEFT", "selectPreviousColumnChangeLead",
  1131. "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
  1132. "DOWN", "selectNextRow",
  1133. "KP_DOWN", "selectNextRow",
  1134. "shift DOWN", "selectNextRowExtendSelection",
  1135. "shift KP_DOWN", "selectNextRowExtendSelection",
  1136. "ctrl shift DOWN", "selectNextRowExtendSelection",
  1137. "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
  1138. "ctrl DOWN", "selectNextRowChangeLead",
  1139. "ctrl KP_DOWN", "selectNextRowChangeLead",
  1140. "UP", "selectPreviousRow",
  1141. "KP_UP", "selectPreviousRow",
  1142. "shift UP", "selectPreviousRowExtendSelection",
  1143. "shift KP_UP", "selectPreviousRowExtendSelection",
  1144. "ctrl shift UP", "selectPreviousRowExtendSelection",
  1145. "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
  1146. "ctrl UP", "selectPreviousRowChangeLead",
  1147. "ctrl KP_UP", "selectPreviousRowChangeLead",
  1148. "HOME", "selectFirstColumn",
  1149. "shift HOME", "selectFirstColumnExtendSelection",
  1150. "ctrl shift HOME", "selectFirstRowExtendSelection",
  1151. "ctrl HOME", "selectFirstRow",
  1152. "END", "selectLastColumn",
  1153. "shift END", "selectLastColumnExtendSelection",
  1154. "ctrl shift END", "selectLastRowExtendSelection",
  1155. "ctrl END", "selectLastRow",
  1156. "PAGE_UP", "scrollUpChangeSelection",
  1157. "shift PAGE_UP", "scrollUpExtendSelection",
  1158. "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
  1159. "ctrl PAGE_UP", "scrollLeftChangeSelection",
  1160. "PAGE_DOWN", "scrollDownChangeSelection",
  1161. "shift PAGE_DOWN", "scrollDownExtendSelection",
  1162. "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
  1163. "ctrl PAGE_DOWN", "scrollRightChangeSelection",
  1164. "TAB", "selectNextColumnCell",
  1165. "shift TAB", "selectPreviousColumnCell",
  1166. "ENTER", "selectNextRowCell",
  1167. "shift ENTER", "selectPreviousRowCell",
  1168. "ctrl A", "selectAll",
  1169. "ctrl SLASH", "selectAll",
  1170. "ctrl BACK_SLASH", "clearSelection",
  1171. "ESCAPE", "cancel",
  1172. "F2", "startEditing",
  1173. "SPACE", "addToSelection",
  1174. "ctrl SPACE", "toggleAndAnchor",
  1175. "shift SPACE", "extendTo",
  1176. "ctrl shift SPACE", "moveSelectionTo"
  1177. }),
  1178. "Table.ancestorInputMap.RightToLeft",
  1179. new UIDefaults.LazyInputMap(new Object[] {
  1180. "RIGHT", "selectPreviousColumn",
  1181. "KP_RIGHT", "selectPreviousColumn",
  1182. "shift RIGHT", "selectPreviousColumnExtendSelection",
  1183. "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
  1184. "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
  1185. "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
  1186. "shift RIGHT", "selectPreviousColumnChangeLead",
  1187. "shift KP_RIGHT", "selectPreviousColumnChangeLead",
  1188. "LEFT", "selectNextColumn",
  1189. "KP_LEFT", "selectNextColumn",
  1190. "shift LEFT", "selectNextColumnExtendSelection",
  1191. "shift KP_LEFT", "selectNextColumnExtendSelection",
  1192. "ctrl shift LEFT", "selectNextColumnExtendSelection",
  1193. "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
  1194. "ctrl LEFT", "selectNextColumnChangeLead",
  1195. "ctrl KP_LEFT", "selectNextColumnChangeLead",
  1196. "ctrl PAGE_UP", "scrollRightChangeSelection",
  1197. "ctrl PAGE_DOWN", "scrollLeftChangeSelection",
  1198. "ctrl shift PAGE_UP", "scrollRightExtendSelection",
  1199. "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
  1200. }),
  1201. "TableHeader.font", dialogPlain12,
  1202. "TableHeader.foreground", controlText, // header text color
  1203. "TableHeader.background", control, // header background
  1204. "TableHeader.cellBorder", tableHeaderBorder,
  1205. // *** Text
  1206. "TextField.font", sansSerifPlain12,
  1207. "TextField.background", window,
  1208. "TextField.foreground", textText,
  1209. "TextField.shadow", controlShadow,
  1210. "TextField.darkShadow", controlDkShadow,
  1211. "TextField.light", controlHighlight,
  1212. "TextField.highlight", controlLtHighlight,
  1213. "TextField.inactiveForeground", textInactiveText,
  1214. "TextField.inactiveBackground", control,
  1215. "TextField.selectionBackground", textHighlight,
  1216. "TextField.selectionForeground", textHighlightText,
  1217. "TextField.caretForeground", textText,
  1218. "TextField.caretBlinkRate", caretBlinkRate,
  1219. "TextField.border", textFieldBorder,
  1220. "TextField.margin", zeroInsets,
  1221. "FormattedTextField.font", sansSerifPlain12,
  1222. "FormattedTextField.background", window,
  1223. "FormattedTextField.foreground", textText,
  1224. "FormattedTextField.inactiveForeground", textInactiveText,
  1225. "FormattedTextField.inactiveBackground", control,
  1226. "FormattedTextField.selectionBackground", textHighlight,
  1227. "FormattedTextField.selectionForeground", textHighlightText,
  1228. "FormattedTextField.caretForeground", textText,
  1229. "FormattedTextField.caretBlinkRate", caretBlinkRate,
  1230. "FormattedTextField.border", textFieldBorder,
  1231. "FormattedTextField.margin", zeroInsets,
  1232. "FormattedTextField.focusInputMap",
  1233. new UIDefaults.LazyInputMap(new Object[] {
  1234. "ctrl C", DefaultEditorKit.copyAction,
  1235. "ctrl V", DefaultEditorKit.pasteAction,
  1236. "ctrl X", DefaultEditorKit.cutAction,
  1237. "COPY", DefaultEditorKit.copyAction,
  1238. "PASTE", DefaultEditorKit.pasteAction,
  1239. "CUT", DefaultEditorKit.cutAction,
  1240. "shift LEFT", DefaultEditorKit.selectionBackwardAction,
  1241. "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
  1242. "shift RIGHT", DefaultEditorKit.selectionForwardAction,
  1243. "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
  1244. "ctrl LEFT", DefaultEditorKit.previousWordAction,
  1245. "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
  1246. "ctrl RIGHT", DefaultEditorKit.nextWordAction,
  1247. "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
  1248. "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
  1249. "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
  1250. "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
  1251. "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
  1252. "ctrl A", DefaultEditorKit.selectAllAction,
  1253. "HOME", DefaultEditorKit.beginLineAction,
  1254. "END", DefaultEditorKit.endLineAction,
  1255. "shift HOME", DefaultEditorKit.selectionBeginLineAction,
  1256. "shift END", DefaultEditorKit.selectionEndLineAction,
  1257. "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
  1258. "ctrl H", DefaultEditorKit.deletePrevCharAction,
  1259. "DELETE", DefaultEditorKit.deleteNextCharAction,
  1260. "RIGHT", DefaultEditorKit.forwardAction,
  1261. "LEFT", DefaultEditorKit.backwardAction,
  1262. "KP_RIGHT", DefaultEditorKit.forwardAction,
  1263. "KP_LEFT", DefaultEditorKit.backwardAction,
  1264. "ENTER", JTextField.notifyAction,
  1265. "ctrl BACK_SLASH", "unselect",
  1266. "control shift O", "toggle-componentOrientation",
  1267. "ESCAPE", "reset-field-edit",
  1268. "UP", "increment",
  1269. "KP_UP", "increment",
  1270. "DOWN", "decrement",
  1271. "KP_DOWN", "decrement",
  1272. }),
  1273. "PasswordField.font", monospacedPlain12,
  1274. "PasswordField.background", window,
  1275. "PasswordField.foreground", textText,
  1276. "PasswordField.inactiveForeground", textInactiveText,
  1277. "PasswordField.inactiveBackground", control,
  1278. "PasswordField.selectionBackground", textHighlight,
  1279. "PasswordField.selectionForeground", textHighlightText,
  1280. "PasswordField.caretForeground", textText,
  1281. "PasswordField.caretBlinkRate", caretBlinkRate,
  1282. "PasswordField.border", textFieldBorder,
  1283. "PasswordField.margin", zeroInsets,
  1284. "TextArea.font", monospacedPlain12,
  1285. "TextArea.background", window,
  1286. "TextArea.foreground", textText,
  1287. "TextArea.inactiveForeground", textInactiveText,
  1288. "TextArea.selectionBackground", textHighlight,
  1289. "TextArea.selectionForeground", textHighlightText,
  1290. "TextArea.caretForeground", textText,
  1291. "TextArea.caretBlinkRate", caretBlinkRate,
  1292. "TextArea.border", marginBorder,
  1293. "TextArea.margin", zeroInsets,
  1294. "TextPane.font", serifPlain12,
  1295. "TextPane.background", white,
  1296. "TextPane.foreground", textText,
  1297. "TextPane.selectionBackground", textHighlight,
  1298. "TextPane.selectionForeground", textHighlightText,
  1299. "TextPane.caretForeground", textText,
  1300. "TextPane.caretBlinkRate", caretBlinkRate,
  1301. "TextPane.inactiveForeground", textInactiveText,
  1302. "TextPane.border", marginBorder,
  1303. "TextPane.margin", editorMargin,
  1304. "EditorPane.font", serifPlain12,
  1305. "EditorPane.background", white,
  1306. "EditorPane.foreground", textText,
  1307. "EditorPane.selectionBackground", textHighlight,
  1308. "EditorPane.selectionForeground", textHighlightText,
  1309. "EditorPane.caretForeground", textText,
  1310. "EditorPane.caretBlinkRate", caretBlinkRate,
  1311. "EditorPane.inactiveForeground", textInactiveText,
  1312. "EditorPane.border", marginBorder,
  1313. "EditorPane.margin", editorMargin,
  1314. // *** TitledBorder
  1315. "TitledBorder.font", dialogPlain12,
  1316. "TitledBorder.titleColor", controlText,
  1317. "TitledBorder.border", etchedBorder,
  1318. // *** ToolBar
  1319. "ToolBar.font", dialogPlain12,
  1320. "ToolBar.background", control,
  1321. "ToolBar.foreground", controlText,
  1322. "ToolBar.shadow", controlShadow,
  1323. "ToolBar.darkShadow", controlDkShadow,
  1324. "ToolBar.light", controlHighlight,
  1325. "ToolBar.highlight", controlLtHighlight,
  1326. "ToolBar.dockingBackground", control,
  1327. "ToolBar.dockingForeground", red,
  1328. "ToolBar.floatingBackground", control,
  1329. "ToolBar.floatingForeground", darkGray,
  1330. "ToolBar.border", etchedBorder,
  1331. "ToolBar.separatorSize", toolBarSeparatorSize,
  1332. "ToolBar.ancestorInputMap",
  1333. new UIDefaults.LazyInputMap(new Object[] {
  1334. "UP", "navigateUp",
  1335. "KP_UP", "navigateUp",
  1336. "DOWN", "navigateDown",
  1337. "KP_DOWN", "navigateDown",
  1338. "LEFT", "navigateLeft",
  1339. "KP_LEFT", "navigateLeft",
  1340. "RIGHT", "navigateRight",
  1341. "KP_RIGHT", "navigateRight"
  1342. }),
  1343. // *** ToolTips
  1344. "ToolTip.font", sansSerifPlain12,
  1345. "ToolTip.background", table.get("info"),
  1346. "ToolTip.foreground", table.get("infoText"),
  1347. "ToolTip.border", blackLineBorder,
  1348. // ToolTips also support backgroundInactive, borderInactive,
  1349. // and foregroundInactive
  1350. // *** Tree
  1351. "Tree.paintLines", Boolean.TRUE,
  1352. "Tree.lineTypeDashed", Boolean.FALSE,
  1353. "Tree.font", dialogPlain12,
  1354. "Tree.background", window,
  1355. "Tree.foreground", textText,
  1356. "Tree.hash", gray,
  1357. "Tree.textForeground", textText,
  1358. "Tree.textBackground", table.get("text"),
  1359. "Tree.selectionForeground", textHighlightText,
  1360. "Tree.selectionBackground", textHighlight,
  1361. "Tree.selectionBorderColor", black,
  1362. "Tree.editorBorder", blackLineBorder,
  1363. "Tree.leftChildIndent", new Integer(7),
  1364. "Tree.rightChildIndent", new Integer(13),
  1365. "Tree.rowHeight", new Integer(16),
  1366. "Tree.scrollsOnExpand", Boolean.TRUE,
  1367. "Tree.openIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeOpen.gif"),
  1368. "Tree.closedIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeClosed.gif"),
  1369. "Tree.leafIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeLeaf.gif"),
  1370. "Tree.expandedIcon", null,
  1371. "Tree.collapsedIcon", null,
  1372. "Tree.changeSelectionWithFocus", Boolean.TRUE,
  1373. "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE,
  1374. "Tree.timeFactor", oneThousand,
  1375. "Tree.focusInputMap",
  1376. new UIDefaults.LazyInputMap(new Object[] {
  1377. "ctrl C", "copy",
  1378. "ctrl V", "paste",
  1379. "ctrl X", "cut",
  1380. "COPY", "copy",
  1381. "PASTE", "paste",
  1382. "CUT", "cut",
  1383. "UP", "selectPrevious",
  1384. "KP_UP", "selectPrevious",
  1385. "shift UP", "selectPreviousExtendSelection",
  1386. "shift KP_UP", "selectPreviousExtendSelection",
  1387. "ctrl shift UP", "selectPreviousExtendSelection",
  1388. "ctrl shift KP_UP", "selectPreviousExtendSelection",
  1389. "ctrl UP", "selectPreviousChangeLead",
  1390. "ctrl KP_UP", "selectPreviousChangeLead",
  1391. "DOWN", "selectNext",
  1392. "KP_DOWN", "selectNext",
  1393. "shift DOWN", "selectNextExtendSelection",
  1394. "shift KP_DOWN", "selectNextExtendSelection",
  1395. "ctrl shift DOWN", "selectNextExtendSelection",
  1396. "ctrl shift KP_DOWN", "selectNextExtendSelection",
  1397. "ctrl DOWN", "selectNextChangeLead",
  1398. "ctrl KP_DOWN", "selectNextChangeLead",
  1399. "RIGHT", "selectChild",
  1400. "KP_RIGHT", "selectChild",
  1401. "LEFT", "selectParent",
  1402. "KP_LEFT", "selectParent",
  1403. "PAGE_UP", "scrollUpChangeSelection",
  1404. "shift PAGE_UP", "scrollUpExtendSelection",
  1405. "ctrl shift PAGE_UP", "scrollUpExtendSelection",
  1406. "ctrl PAGE_UP", "scrollUpChangeLead",
  1407. "PAGE_DOWN", "scrollDownChangeSelection",
  1408. "shift PAGE_DOWN", "scrollDownExtendSelection",
  1409. "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
  1410. "ctrl PAGE_DOWN", "scrollDownChangeLead",
  1411. "HOME", "selectFirst",
  1412. "shift HOME", "selectFirstExtendSelection",
  1413. "ctrl shift HOME", "selectFirstExtendSelection",
  1414. "ctrl HOME", "selectFirstChangeLead",
  1415. "END", "selectLast",
  1416. "shift END", "selectLastExtendSelection",
  1417. "ctrl shift END", "selectLastExtendSelection",
  1418. "ctrl END", "selectLastChangeLead",
  1419. "F2", "startEditing",
  1420. "ctrl A", "selectAll",
  1421. "ctrl SLASH", "selectAll",
  1422. "ctrl BACK_SLASH", "clearSelection",
  1423. "ctrl LEFT", "scrollLeft",
  1424. "ctrl KP_LEFT", "scrollLeft",
  1425. "ctrl RIGHT", "scrollRight",
  1426. "ctrl KP_RIGHT", "scrollRight",
  1427. "SPACE", "addToSelection",
  1428. "ctrl SPACE", "toggleAndAnchor",
  1429. "shift SPACE", "extendTo",
  1430. "ctrl shift SPACE", "moveSelectionTo"
  1431. }),
  1432. "Tree.focusInputMap.RightToLeft",
  1433. new UIDefaults.LazyInputMap(new Object[] {
  1434. "RIGHT", "selectParent",
  1435. "KP_RIGHT", "selectParent",
  1436. "LEFT", "selectChild",
  1437. "KP_LEFT", "selectChild",
  1438. }),
  1439. "Tree.ancestorInputMap",
  1440. new UIDefaults.LazyInputMap(new Object[] {
  1441. "ESCAPE", "cancel"
  1442. }),
  1443. // Bind specific keys that can invoke popup on currently
  1444. // focused JComponent
  1445. "RootPane.ancestorInputMap",
  1446. new UIDefaults.LazyInputMap(new Object[] {
  1447. "shift F10", "postPopup",
  1448. }),
  1449. // These bindings are only enabled when there is a default
  1450. // button set on the rootpane.
  1451. "RootPane.defaultButtonWindowKeyBindings", new Object[] {
  1452. "ENTER", "press",
  1453. "released ENTER", "release",
  1454. "ctrl ENTER", "press",
  1455. "ctrl released ENTER", "release"
  1456. },
  1457. };
  1458. table.putDefaults(defaults);
  1459. }
  1460. /**
  1461. * Returns the ui that is of type <code>klass</code>, or null if
  1462. * one can not be found.
  1463. */
  1464. static Object getUIOfType(ComponentUI ui, Class klass) {
  1465. if (klass.isInstance(ui)) {
  1466. return ui;
  1467. }
  1468. return null;
  1469. }
  1470. // ********* Auditory Cue support methods and objects *********
  1471. // also see the "AuditoryCues" section of the defaults table
  1472. /**
  1473. * Returns an <code>ActionMap</code>.
  1474. * <P>
  1475. * This <code>ActionMap</code> contains <code>Actions</code> that
  1476. * embody the ability to render an auditory cue. These auditory
  1477. * cues map onto user and system activities that may be useful
  1478. * for an end user to know about (such as a dialog box appearing).
  1479. * <P>
  1480. * At the appropriate time in a <code>JComponent</code> UI's lifecycle,
  1481. * the ComponentUI is responsible for getting the appropriate
  1482. * <code>Action</code> out of the <code>ActionMap</code> and passing
  1483. * it on to <code>playSound</code>.
  1484. * <P>
  1485. * The <code>Actions</code> in this <code>ActionMap</code> are
  1486. * created by the <code>createAudioAction</code> method.
  1487. *
  1488. * @return an ActionMap containing Actions
  1489. * responsible for rendering auditory cues
  1490. * @see #createAudioAction
  1491. * @see #playSound(Action)
  1492. * @since 1.4
  1493. */
  1494. protected ActionMap getAudioActionMap() {
  1495. ActionMap audioActionMap = (ActionMap)UIManager.get(
  1496. "AuditoryCues.actionMap");
  1497. if (audioActionMap == null) {
  1498. Object[] acList = (Object[])UIManager.get("AuditoryCues.cueList");
  1499. if (acList != null) {
  1500. audioActionMap = new ActionMapUIResource();
  1501. for(int counter = acList.length-1; counter >= 0; counter--) {
  1502. audioActionMap.put(acList[counter],
  1503. createAudioAction(acList[counter]));
  1504. }
  1505. }
  1506. UIManager.getLookAndFeelDefaults().put("AuditoryCues.actionMap",
  1507. audioActionMap);
  1508. }
  1509. return audioActionMap;
  1510. }
  1511. /**
  1512. * Returns an <code>Action</code>.
  1513. * <P>
  1514. * This Action contains the information and logic to render an
  1515. * auditory cue. The <code>Object</code> that is passed to this
  1516. * method contains the information needed to render the auditory
  1517. * cue. Normally, this <code>Object</code> is a <code>String</code>
  1518. * that points to an audio file relative to the current package.
  1519. * This <code>Action</code>'s <code>actionPerformed</code> method
  1520. * is fired by the <code>playSound</code> method.
  1521. *
  1522. * @return an Action which knows how to render the auditory
  1523. * cue for one particular system or user activity
  1524. * @see #playSound(Action)
  1525. * @since 1.4
  1526. */
  1527. protected Action createAudioAction(Object key) {
  1528. if (key != null) {
  1529. String audioKey = (String)key;
  1530. String audioValue = (String)UIManager.get(key);
  1531. return new AudioAction(audioKey, audioValue);
  1532. } else {
  1533. return null;
  1534. }
  1535. }
  1536. /**
  1537. * Pass the name String to the super constructor. This is used
  1538. * later to identify the Action and decide whether to play it or
  1539. * not. Store the resource String. I is used to get the audio
  1540. * resource. In this case, the resource is an audio file.
  1541. *
  1542. * @since 1.4
  1543. */
  1544. private class AudioAction extends AbstractAction implements LineListener {
  1545. // We strive to only play one sound at a time (other platforms
  1546. // appear to do this). This is done by maintaining the field
  1547. // clipPlaying. Every time a sound is to be played,
  1548. // cancelCurrentSound is invoked to cancel any sound that may be
  1549. // playing.
  1550. private String audioResource;
  1551. private byte[] audioBuffer;
  1552. /**
  1553. * The String is the name of the Action and
  1554. * points to the audio resource.
  1555. * The byte[] is a buffer of the audio bits.
  1556. */
  1557. public AudioAction(String name, String resource) {
  1558. super(name);
  1559. audioResource = resource;
  1560. }
  1561. public void actionPerformed(ActionEvent e) {
  1562. if (audioBuffer == null) {
  1563. audioBuffer = loadAudioData(audioResource);
  1564. }
  1565. if (audioBuffer != null) {
  1566. cancelCurrentSound(null);
  1567. try {
  1568. AudioInputStream soundStream =
  1569. AudioSystem.getAudioInputStream(
  1570. new ByteArrayInputStream(audioBuffer));
  1571. DataLine.Info info =
  1572. new DataLine.Info(Clip.class, soundStream.getFormat());
  1573. Clip clip = (Clip) AudioSystem.getLine(info);
  1574. clip.open(soundStream);
  1575. clip.addLineListener(this);
  1576. synchronized(audioLock) {
  1577. clipPlaying = clip;
  1578. }
  1579. clip.start();
  1580. } catch (Exception ex) {}
  1581. }
  1582. }
  1583. public void update(LineEvent event) {
  1584. if (event.getType() == LineEvent.Type.STOP) {
  1585. cancelCurrentSound((Clip)event.getLine());
  1586. }
  1587. }
  1588. /**
  1589. * If the parameter is null, or equal to the currently
  1590. * playing sound, then cancel the currently playing sound.
  1591. */
  1592. private void cancelCurrentSound(Clip clip) {
  1593. Clip lastClip = null;
  1594. synchronized(audioLock) {
  1595. if (clip == null || clip == clipPlaying) {
  1596. lastClip = clipPlaying;
  1597. clipPlaying = null;
  1598. }
  1599. }
  1600. if (lastClip != null) {
  1601. lastClip.removeLineListener(this);
  1602. lastClip.close();
  1603. }
  1604. }
  1605. }
  1606. /**
  1607. * Utility method that loads audio bits for the specified
  1608. * <code>soundFile</code> filename. If this method is unable to
  1609. * build a viable path name from the <code>baseClass</code> and
  1610. * <code>soundFile</code> passed into this method, it will
  1611. * return <code>null</code>.
  1612. *
  1613. * @param baseClass used as the root class/location to get the
  1614. * soundFile from
  1615. * @param soundFile the name of the audio file to be retrieved
  1616. * from disk
  1617. * @return A byte[] with audio data or null
  1618. * @since 1.4
  1619. */
  1620. private byte[] loadAudioData(final String soundFile){
  1621. if (soundFile == null) {
  1622. return null;
  1623. }
  1624. /* Copy resource into a byte array. This is
  1625. * necessary because several browsers consider
  1626. * Class.getResource a security risk since it
  1627. * can be used to load additional classes.
  1628. * Class.getResourceAsStream just returns raw
  1629. * bytes, which we can convert to a sound.
  1630. */
  1631. byte[] buffer = (byte[])AccessController.doPrivileged(
  1632. new PrivilegedAction() {
  1633. public Object run() {
  1634. try {
  1635. InputStream resource = BasicLookAndFeel.this.
  1636. getClass().getResourceAsStream(soundFile);
  1637. if (resource == null) {
  1638. return null;
  1639. }
  1640. BufferedInputStream in =
  1641. new BufferedInputStream(resource);
  1642. ByteArrayOutputStream out =
  1643. new ByteArrayOutputStream(1024);
  1644. byte[] buffer = new byte[1024];
  1645. int n;
  1646. while ((n = in.read(buffer)) > 0) {
  1647. out.write(buffer, 0, n);
  1648. }
  1649. in.close();
  1650. out.flush();
  1651. buffer = out.toByteArray();
  1652. return buffer;
  1653. } catch (IOException ioe) {
  1654. System.err.println(ioe.toString());
  1655. return null;
  1656. }
  1657. }
  1658. });
  1659. if (buffer == null) {
  1660. System.err.println(getClass().getName() + "/" +
  1661. soundFile + " not found.");
  1662. return null;
  1663. }
  1664. if (buffer.length == 0) {
  1665. System.err.println("warning: " + soundFile +
  1666. " is zero-length");
  1667. return null;
  1668. }
  1669. return buffer;
  1670. }
  1671. /**
  1672. * Decides whether to fire the <code>Action</code> that is passed into
  1673. * it and, if needed, fires the <code>Action</code>'s
  1674. * <code>actionPerformed</code> method. This has the effect
  1675. * of rendering the audio appropriate for the situation.
  1676. * <P>
  1677. * The set of possible cues to be played are stored in the default
  1678. * table value "AuditoryCues.cueList". The cues that will be played
  1679. * are stored in "AuditoryCues.playList".
  1680. *
  1681. * @param audioAction an Action that knows how to render the audio
  1682. * associated with the system or user activity
  1683. * that is occurring
  1684. * @since 1.4
  1685. */
  1686. protected void playSound(Action audioAction) {
  1687. if (audioAction != null) {
  1688. Object[] audioStrings = (Object[])
  1689. UIManager.get("AuditoryCues.playList");
  1690. if (audioStrings != null) {
  1691. // create a HashSet to help us decide to play or not
  1692. HashSet audioCues = new HashSet();
  1693. for (int i = 0; i < audioStrings.length; i++) {
  1694. audioCues.add(audioStrings[i]);
  1695. }
  1696. // get the name of the Action
  1697. String actionName = (String)audioAction.getValue(Action.NAME);
  1698. // if the actionName is in the audioCues HashSet, play it.
  1699. if (audioCues.contains(actionName)) {
  1700. audioAction.actionPerformed(new
  1701. ActionEvent(this, ActionEvent.ACTION_PERFORMED,
  1702. actionName));
  1703. }
  1704. }
  1705. }
  1706. }
  1707. /**
  1708. * Sets the parent of the passed in ActionMap to be the audio action
  1709. * map.
  1710. */
  1711. static void installAudioActionMap(ActionMap map) {
  1712. LookAndFeel laf = UIManager.getLookAndFeel();
  1713. if (laf instanceof BasicLookAndFeel) {
  1714. map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
  1715. }
  1716. }
  1717. /**
  1718. * Helper method to play a named sound.
  1719. *
  1720. * @param c JComponent to play the sound for.
  1721. * @param actionKey Key for the sound.
  1722. */
  1723. static void playSound(JComponent c, Object actionKey) {
  1724. LookAndFeel laf = UIManager.getLookAndFeel();
  1725. if (laf instanceof BasicLookAndFeel) {
  1726. ActionMap map = c.getActionMap();
  1727. if (map != null) {
  1728. Action audioAction = map.get(actionKey);
  1729. if (audioAction != null) {
  1730. // pass off firing the Action to a utility method
  1731. ((BasicLookAndFeel)laf).playSound(audioAction);
  1732. }
  1733. }
  1734. }
  1735. }
  1736. // At this point we need this method here. But we assume that there
  1737. // will be a common method for this purpose in the future releases.
  1738. static boolean compositeRequestFocus(Component component) {
  1739. if (component instanceof Container) {
  1740. Container container = (Container)component;
  1741. if (container.isFocusCycleRoot()) {
  1742. FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
  1743. Component comp = policy.getDefaultComponent(container);
  1744. if (comp!=null) {
  1745. comp.requestFocus();
  1746. return true;
  1747. }
  1748. }
  1749. Container rootAncestor = container.getFocusCycleRootAncestor();
  1750. if (rootAncestor!=null) {
  1751. FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy();
  1752. Component comp = policy.getComponentAfter(rootAncestor, container);
  1753. if (comp!=null && SwingUtilities.isDescendingFrom(comp, container)) {
  1754. comp.requestFocus();
  1755. return true;
  1756. }
  1757. }
  1758. }
  1759. if (component.isFocusable()) {
  1760. component.requestFocus();
  1761. return true;
  1762. }
  1763. return false;
  1764. }
  1765. /**
  1766. * This is invoked from BasicPopupUI when an instance of BasicPopupUI
  1767. * is created. This gives us an opportunity to register Popup specific
  1768. * listeners.
  1769. */
  1770. void createdPopup() {
  1771. if (invocator == null) {
  1772. invocator = new PopupInvocationHelper();
  1773. hasPopups = true;
  1774. }
  1775. }
  1776. /**
  1777. * This class contains listener that watches for all the mouse
  1778. * events that can possibly invoke popup on the component
  1779. */
  1780. class PopupInvocationHelper implements AWTEventListener,PrivilegedAction {
  1781. PopupInvocationHelper() {
  1782. super();
  1783. AccessController.doPrivileged(this);
  1784. }
  1785. public Object run() {
  1786. Toolkit tk = Toolkit.getDefaultToolkit();
  1787. if(invocator == null) {
  1788. tk.addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);
  1789. } else {
  1790. tk.removeAWTEventListener(invocator);
  1791. }
  1792. // Return value not used.
  1793. return null;
  1794. }
  1795. public void eventDispatched(AWTEvent ev) {
  1796. if((ev.getID() & AWTEvent.MOUSE_EVENT_MASK) != 0) {
  1797. MouseEvent me = (MouseEvent) ev;
  1798. if(me.isPopupTrigger()) {
  1799. MenuElement[] elems = MenuSelectionManager
  1800. .defaultManager()
  1801. .getSelectedPath();
  1802. if(elems != null && elems.length != 0) {
  1803. return;
  1804. // We shall not interfere with already opened menu
  1805. }
  1806. Object c = me.getSource();
  1807. if(c instanceof JComponent) {
  1808. JComponent src = (JComponent) c;
  1809. if(src.getComponentPopupMenu() != null) {
  1810. Point pt = src.getPopupLocation(me);
  1811. if(pt == null) {
  1812. pt = me.getPoint();
  1813. }
  1814. src.getComponentPopupMenu().show(src, pt.x, pt.y);
  1815. me.consume();
  1816. }
  1817. }
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }