author | serb |
Fri, 21 Aug 2015 20:59:07 +0300 | |
changeset 32484 | e07799997e1f |
parent 31653 | d88ff422c7fb |
child 32485 | e00f713e6103 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
31653
d88ff422c7fb
8080405: Exception in thread "AWT-EventQueue-1" java.security.AccessControlException
serb
parents:
29922
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
/* |
|
27 |
* <p>These classes are designed to be used while the |
|
28 |
* corresponding <code>LookAndFeel</code> class has been installed |
|
29 |
* (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>). |
|
30 |
* Using them while a different <code>LookAndFeel</code> is installed |
|
31 |
* may produce unexpected results, including exceptions. |
|
32 |
* Additionally, changing the <code>LookAndFeel</code> |
|
33 |
* maintained by the <code>UIManager</code> without updating the |
|
34 |
* corresponding <code>ComponentUI</code> of any |
|
35 |
* <code>JComponent</code>s may also produce unexpected results, |
|
36 |
* such as the wrong colors showing up, and is generally not |
|
37 |
* encouraged. |
|
38 |
* |
|
39 |
*/ |
|
40 |
||
41 |
package com.sun.java.swing.plaf.windows; |
|
42 |
||
43 |
import java.awt.*; |
|
44 |
import java.awt.image.BufferedImage; |
|
45 |
import java.awt.image.ImageFilter; |
|
46 |
import java.awt.image.ImageProducer; |
|
47 |
import java.awt.image.FilteredImageSource; |
|
48 |
import java.awt.image.RGBImageFilter; |
|
49 |
||
50 |
import javax.swing.plaf.*; |
|
51 |
import javax.swing.*; |
|
52 |
import javax.swing.plaf.basic.*; |
|
53 |
import javax.swing.border.*; |
|
54 |
import javax.swing.text.DefaultEditorKit; |
|
23612 | 55 |
import static javax.swing.UIDefaults.LazyValue; |
2 | 56 |
|
57 |
import java.awt.Font; |
|
58 |
import java.awt.Color; |
|
59 |
import java.awt.event.ActionEvent; |
|
60 |
||
61 |
import java.security.AccessController; |
|
62 |
||
63 |
import sun.awt.SunToolkit; |
|
64 |
import sun.awt.OSInfo; |
|
65 |
import sun.awt.shell.ShellFolder; |
|
3928 | 66 |
import sun.font.FontUtilities; |
29922 | 67 |
import sun.misc.ManagedLocalsThread; |
2 | 68 |
import sun.security.action.GetPropertyAction; |
69 |
||
70 |
import sun.swing.DefaultLayoutStyle; |
|
71 |
import sun.swing.ImageIconUIResource; |
|
23612 | 72 |
import sun.swing.icon.SortArrowIcon; |
2 | 73 |
import sun.swing.SwingUtilities2; |
74 |
import sun.swing.StringUIClientPropertyKey; |
|
23612 | 75 |
import sun.swing.plaf.windows.ClassicSortArrowIcon; |
2 | 76 |
|
77 |
import static com.sun.java.swing.plaf.windows.TMSchema.*; |
|
78 |
import static com.sun.java.swing.plaf.windows.XPStyle.Skin; |
|
79 |
||
80 |
import com.sun.java.swing.plaf.windows.WindowsIconFactory.VistaMenuItemCheckIconFactory; |
|
81 |
||
82 |
/** |
|
83 |
* Implements the Windows95/98/NT/2000 Look and Feel. |
|
84 |
* UI classes not implemented specifically for Windows will |
|
85 |
* default to those implemented in Basic. |
|
86 |
* <p> |
|
87 |
* <strong>Warning:</strong> |
|
88 |
* Serialized objects of this class will not be compatible with |
|
89 |
* future Swing releases. The current serialization support is appropriate |
|
90 |
* for short term storage or RMI between applications running the same |
|
91 |
* version of Swing. A future release of Swing will provide support for |
|
92 |
* long term persistence. |
|
93 |
* |
|
94 |
* @author unattributed |
|
95 |
*/ |
|
23632
cd7a34d12e8c
8033908: Fix serial lint warnings in com.sun.java.swing.plaf
darcy
parents:
23612
diff
changeset
|
96 |
@SuppressWarnings("serial") // Superclass is not serializable across versions |
2 | 97 |
public class WindowsLookAndFeel extends BasicLookAndFeel |
98 |
{ |
|
99 |
/** |
|
100 |
* A client property that can be used with any JComponent that will end up |
|
101 |
* calling the LookAndFeel.getDisabledIcon method. This client property, |
|
102 |
* when set to Boolean.TRUE, will cause getDisabledIcon to use an |
|
103 |
* alternate algorithm for creating disabled icons to produce icons |
|
104 |
* that appear similar to the native Windows file chooser |
|
105 |
*/ |
|
106 |
static final Object HI_RES_DISABLED_ICON_CLIENT_KEY = |
|
107 |
new StringUIClientPropertyKey( |
|
108 |
"WindowsLookAndFeel.generateHiResDisabledIcon"); |
|
109 |
||
110 |
private boolean updatePending = false; |
|
111 |
||
112 |
private boolean useSystemFontSettings = true; |
|
113 |
private boolean useSystemFontSizeSettings; |
|
114 |
||
115 |
// These properties are not used directly, but are kept as |
|
116 |
// private members to avoid being GC'd. |
|
117 |
private DesktopProperty themeActive, dllName, colorName, sizeName; |
|
118 |
private DesktopProperty aaSettings; |
|
119 |
||
120 |
private transient LayoutStyle style; |
|
121 |
||
122 |
/** |
|
123 |
* Base dialog units along the horizontal axis. |
|
124 |
*/ |
|
125 |
private int baseUnitX; |
|
126 |
||
127 |
/** |
|
128 |
* Base dialog units along the vertical axis. |
|
129 |
*/ |
|
130 |
private int baseUnitY; |
|
131 |
||
132 |
public String getName() { |
|
133 |
return "Windows"; |
|
134 |
} |
|
135 |
||
136 |
public String getDescription() { |
|
137 |
return "The Microsoft Windows Look and Feel"; |
|
138 |
} |
|
139 |
||
140 |
public String getID() { |
|
141 |
return "Windows"; |
|
142 |
} |
|
143 |
||
144 |
public boolean isNativeLookAndFeel() { |
|
145 |
return OSInfo.getOSType() == OSInfo.OSType.WINDOWS; |
|
146 |
} |
|
147 |
||
148 |
public boolean isSupportedLookAndFeel() { |
|
149 |
return isNativeLookAndFeel(); |
|
150 |
} |
|
151 |
||
152 |
public void initialize() { |
|
153 |
super.initialize(); |
|
154 |
||
155 |
// Set the flag which determines which version of Windows should |
|
156 |
// be rendered. This flag only need to be set once. |
|
157 |
// if version <= 4.0 then the classic LAF should be loaded. |
|
158 |
if (OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0) { |
|
159 |
isClassicWindows = true; |
|
160 |
} else { |
|
161 |
isClassicWindows = false; |
|
162 |
XPStyle.invalidateStyle(); |
|
163 |
} |
|
164 |
||
165 |
// Using the fonts set by the user can potentially cause |
|
166 |
// performance and compatibility issues, so allow this feature |
|
167 |
// to be switched off either at runtime or programmatically |
|
168 |
// |
|
169 |
String systemFonts = java.security.AccessController.doPrivileged( |
|
170 |
new GetPropertyAction("swing.useSystemFontSettings")); |
|
171 |
useSystemFontSettings = (systemFonts == null || |
|
172 |
Boolean.valueOf(systemFonts).booleanValue()); |
|
173 |
||
174 |
if (useSystemFontSettings) { |
|
175 |
Object value = UIManager.get("Application.useSystemFontSettings"); |
|
176 |
||
177 |
useSystemFontSettings = (value == null || |
|
178 |
Boolean.TRUE.equals(value)); |
|
179 |
} |
|
180 |
KeyboardFocusManager.getCurrentKeyboardFocusManager(). |
|
181 |
addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor); |
|
182 |
||
183 |
} |
|
184 |
||
185 |
/** |
|
186 |
* Initialize the uiClassID to BasicComponentUI mapping. |
|
187 |
* The JComponent classes define their own uiClassID constants |
|
188 |
* (see AbstractComponent.getUIClassID). This table must |
|
189 |
* map those constants to a BasicComponentUI class of the |
|
190 |
* appropriate type. |
|
191 |
* |
|
192 |
* @see BasicLookAndFeel#getDefaults |
|
193 |
*/ |
|
194 |
protected void initClassDefaults(UIDefaults table) |
|
195 |
{ |
|
196 |
super.initClassDefaults(table); |
|
197 |
||
198 |
final String windowsPackageName = "com.sun.java.swing.plaf.windows."; |
|
199 |
||
200 |
Object[] uiDefaults = { |
|
201 |
"ButtonUI", windowsPackageName + "WindowsButtonUI", |
|
202 |
"CheckBoxUI", windowsPackageName + "WindowsCheckBoxUI", |
|
203 |
"CheckBoxMenuItemUI", windowsPackageName + "WindowsCheckBoxMenuItemUI", |
|
204 |
"LabelUI", windowsPackageName + "WindowsLabelUI", |
|
205 |
"RadioButtonUI", windowsPackageName + "WindowsRadioButtonUI", |
|
206 |
"RadioButtonMenuItemUI", windowsPackageName + "WindowsRadioButtonMenuItemUI", |
|
207 |
"ToggleButtonUI", windowsPackageName + "WindowsToggleButtonUI", |
|
208 |
"ProgressBarUI", windowsPackageName + "WindowsProgressBarUI", |
|
209 |
"SliderUI", windowsPackageName + "WindowsSliderUI", |
|
210 |
"SeparatorUI", windowsPackageName + "WindowsSeparatorUI", |
|
211 |
"SplitPaneUI", windowsPackageName + "WindowsSplitPaneUI", |
|
212 |
"SpinnerUI", windowsPackageName + "WindowsSpinnerUI", |
|
213 |
"TabbedPaneUI", windowsPackageName + "WindowsTabbedPaneUI", |
|
214 |
"TextAreaUI", windowsPackageName + "WindowsTextAreaUI", |
|
215 |
"TextFieldUI", windowsPackageName + "WindowsTextFieldUI", |
|
216 |
"PasswordFieldUI", windowsPackageName + "WindowsPasswordFieldUI", |
|
217 |
"TextPaneUI", windowsPackageName + "WindowsTextPaneUI", |
|
218 |
"EditorPaneUI", windowsPackageName + "WindowsEditorPaneUI", |
|
219 |
"TreeUI", windowsPackageName + "WindowsTreeUI", |
|
220 |
"ToolBarUI", windowsPackageName + "WindowsToolBarUI", |
|
221 |
"ToolBarSeparatorUI", windowsPackageName + "WindowsToolBarSeparatorUI", |
|
222 |
"ComboBoxUI", windowsPackageName + "WindowsComboBoxUI", |
|
223 |
"TableHeaderUI", windowsPackageName + "WindowsTableHeaderUI", |
|
224 |
"InternalFrameUI", windowsPackageName + "WindowsInternalFrameUI", |
|
225 |
"DesktopPaneUI", windowsPackageName + "WindowsDesktopPaneUI", |
|
226 |
"DesktopIconUI", windowsPackageName + "WindowsDesktopIconUI", |
|
227 |
"FileChooserUI", windowsPackageName + "WindowsFileChooserUI", |
|
228 |
"MenuUI", windowsPackageName + "WindowsMenuUI", |
|
229 |
"MenuItemUI", windowsPackageName + "WindowsMenuItemUI", |
|
230 |
"MenuBarUI", windowsPackageName + "WindowsMenuBarUI", |
|
231 |
"PopupMenuUI", windowsPackageName + "WindowsPopupMenuUI", |
|
232 |
"PopupMenuSeparatorUI", windowsPackageName + "WindowsPopupMenuSeparatorUI", |
|
233 |
"ScrollBarUI", windowsPackageName + "WindowsScrollBarUI", |
|
234 |
"RootPaneUI", windowsPackageName + "WindowsRootPaneUI" |
|
235 |
}; |
|
236 |
||
237 |
table.putDefaults(uiDefaults); |
|
238 |
} |
|
239 |
||
240 |
/** |
|
241 |
* Load the SystemColors into the defaults table. The keys |
|
242 |
* for SystemColor defaults are the same as the names of |
|
243 |
* the public fields in SystemColor. If the table is being |
|
244 |
* created on a native Windows platform we use the SystemColor |
|
245 |
* values, otherwise we create color objects whose values match |
|
246 |
* the defaults Windows95 colors. |
|
247 |
*/ |
|
248 |
protected void initSystemColorDefaults(UIDefaults table) |
|
249 |
{ |
|
250 |
String[] defaultSystemColors = { |
|
251 |
"desktop", "#005C5C", /* Color of the desktop background */ |
|
252 |
"activeCaption", "#000080", /* Color for captions (title bars) when they are active. */ |
|
253 |
"activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */ |
|
254 |
"activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */ |
|
255 |
"inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */ |
|
256 |
"inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */ |
|
257 |
"inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */ |
|
258 |
"window", "#FFFFFF", /* Default color for the interior of windows */ |
|
259 |
"windowBorder", "#000000", /* ??? */ |
|
260 |
"windowText", "#000000", /* ??? */ |
|
261 |
"menu", "#C0C0C0", /* Background color for menus */ |
|
262 |
"menuPressedItemB", "#000080", /* LightShadow of menubutton highlight */ |
|
263 |
"menuPressedItemF", "#FFFFFF", /* Default color for foreground "text" in menu item */ |
|
264 |
"menuText", "#000000", /* Text color for menus */ |
|
265 |
"text", "#C0C0C0", /* Text background color */ |
|
266 |
"textText", "#000000", /* Text foreground color */ |
|
267 |
"textHighlight", "#000080", /* Text background color when selected */ |
|
268 |
"textHighlightText", "#FFFFFF", /* Text color when selected */ |
|
269 |
"textInactiveText", "#808080", /* Text color when disabled */ |
|
270 |
"control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */ |
|
271 |
"controlText", "#000000", /* Default color for text in controls */ |
|
272 |
"controlHighlight", "#C0C0C0", |
|
273 |
||
274 |
/*"controlHighlight", "#E0E0E0",*/ /* Specular highlight (opposite of the shadow) */ |
|
275 |
"controlLtHighlight", "#FFFFFF", /* Highlight color for controls */ |
|
276 |
"controlShadow", "#808080", /* Shadow color for controls */ |
|
277 |
"controlDkShadow", "#000000", /* Dark shadow color for controls */ |
|
278 |
"scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */ |
|
279 |
"info", "#FFFFE1", /* ??? */ |
|
280 |
"infoText", "#000000" /* ??? */ |
|
281 |
}; |
|
282 |
||
283 |
loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel()); |
|
284 |
} |
|
285 |
||
286 |
/** |
|
287 |
* Initialize the defaults table with the name of the ResourceBundle |
|
288 |
* used for getting localized defaults. |
|
289 |
*/ |
|
290 |
private void initResourceBundle(UIDefaults table) { |
|
291 |
table.addResourceBundle( "com.sun.java.swing.plaf.windows.resources.windows" ); |
|
292 |
} |
|
293 |
||
294 |
// XXX - there are probably a lot of redundant values that could be removed. |
|
295 |
// ie. Take a look at RadioButtonBorder, etc... |
|
296 |
protected void initComponentDefaults(UIDefaults table) |
|
297 |
{ |
|
298 |
super.initComponentDefaults( table ); |
|
299 |
||
300 |
initResourceBundle(table); |
|
301 |
||
302 |
// *** Shared Fonts |
|
23612 | 303 |
LazyValue dialogPlain12 = t -> new FontUIResource(Font.DIALOG, Font.PLAIN, 12); |
2 | 304 |
|
23612 | 305 |
LazyValue sansSerifPlain12 = t -> new FontUIResource(Font.SANS_SERIF, Font.PLAIN, 12); |
306 |
LazyValue monospacedPlain12 = t -> new FontUIResource(Font.MONOSPACED, Font.PLAIN, 12); |
|
307 |
LazyValue dialogBold12 = t -> new FontUIResource(Font.DIALOG, Font.BOLD, 12); |
|
2 | 308 |
|
309 |
// *** Colors |
|
310 |
// XXX - some of these doens't seem to be used |
|
311 |
ColorUIResource red = new ColorUIResource(Color.red); |
|
312 |
ColorUIResource black = new ColorUIResource(Color.black); |
|
313 |
ColorUIResource white = new ColorUIResource(Color.white); |
|
314 |
ColorUIResource gray = new ColorUIResource(Color.gray); |
|
315 |
ColorUIResource darkGray = new ColorUIResource(Color.darkGray); |
|
316 |
ColorUIResource scrollBarTrackHighlight = darkGray; |
|
317 |
||
318 |
// Set the flag which determines which version of Windows should |
|
319 |
// be rendered. This flag only need to be set once. |
|
320 |
// if version <= 4.0 then the classic LAF should be loaded. |
|
321 |
isClassicWindows = OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0; |
|
322 |
||
323 |
// *** Tree |
|
324 |
Object treeExpandedIcon = WindowsTreeUI.ExpandedIcon.createExpandedIcon(); |
|
325 |
||
326 |
Object treeCollapsedIcon = WindowsTreeUI.CollapsedIcon.createCollapsedIcon(); |
|
327 |
||
328 |
||
329 |
// *** Text |
|
330 |
Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] { |
|
331 |
"control C", DefaultEditorKit.copyAction, |
|
332 |
"control V", DefaultEditorKit.pasteAction, |
|
333 |
"control X", DefaultEditorKit.cutAction, |
|
334 |
"COPY", DefaultEditorKit.copyAction, |
|
335 |
"PASTE", DefaultEditorKit.pasteAction, |
|
336 |
"CUT", DefaultEditorKit.cutAction, |
|
337 |
"control INSERT", DefaultEditorKit.copyAction, |
|
338 |
"shift INSERT", DefaultEditorKit.pasteAction, |
|
339 |
"shift DELETE", DefaultEditorKit.cutAction, |
|
340 |
"control A", DefaultEditorKit.selectAllAction, |
|
341 |
"control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/, |
|
342 |
"shift LEFT", DefaultEditorKit.selectionBackwardAction, |
|
343 |
"shift RIGHT", DefaultEditorKit.selectionForwardAction, |
|
344 |
"control LEFT", DefaultEditorKit.previousWordAction, |
|
345 |
"control RIGHT", DefaultEditorKit.nextWordAction, |
|
346 |
"control shift LEFT", DefaultEditorKit.selectionPreviousWordAction, |
|
347 |
"control shift RIGHT", DefaultEditorKit.selectionNextWordAction, |
|
348 |
"HOME", DefaultEditorKit.beginLineAction, |
|
349 |
"END", DefaultEditorKit.endLineAction, |
|
350 |
"shift HOME", DefaultEditorKit.selectionBeginLineAction, |
|
351 |
"shift END", DefaultEditorKit.selectionEndLineAction, |
|
352 |
"BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
353 |
"shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
354 |
"ctrl H", DefaultEditorKit.deletePrevCharAction, |
|
355 |
"DELETE", DefaultEditorKit.deleteNextCharAction, |
|
356 |
"ctrl DELETE", DefaultEditorKit.deleteNextWordAction, |
|
357 |
"ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction, |
|
358 |
"RIGHT", DefaultEditorKit.forwardAction, |
|
359 |
"LEFT", DefaultEditorKit.backwardAction, |
|
360 |
"KP_RIGHT", DefaultEditorKit.forwardAction, |
|
361 |
"KP_LEFT", DefaultEditorKit.backwardAction, |
|
362 |
"ENTER", JTextField.notifyAction, |
|
363 |
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/ |
|
364 |
}); |
|
365 |
||
366 |
Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] { |
|
367 |
"control C", DefaultEditorKit.copyAction, |
|
368 |
"control V", DefaultEditorKit.pasteAction, |
|
369 |
"control X", DefaultEditorKit.cutAction, |
|
370 |
"COPY", DefaultEditorKit.copyAction, |
|
371 |
"PASTE", DefaultEditorKit.pasteAction, |
|
372 |
"CUT", DefaultEditorKit.cutAction, |
|
373 |
"control INSERT", DefaultEditorKit.copyAction, |
|
374 |
"shift INSERT", DefaultEditorKit.pasteAction, |
|
375 |
"shift DELETE", DefaultEditorKit.cutAction, |
|
376 |
"control A", DefaultEditorKit.selectAllAction, |
|
377 |
"control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/, |
|
378 |
"shift LEFT", DefaultEditorKit.selectionBackwardAction, |
|
379 |
"shift RIGHT", DefaultEditorKit.selectionForwardAction, |
|
380 |
"control LEFT", DefaultEditorKit.beginLineAction, |
|
381 |
"control RIGHT", DefaultEditorKit.endLineAction, |
|
382 |
"control shift LEFT", DefaultEditorKit.selectionBeginLineAction, |
|
383 |
"control shift RIGHT", DefaultEditorKit.selectionEndLineAction, |
|
384 |
"HOME", DefaultEditorKit.beginLineAction, |
|
385 |
"END", DefaultEditorKit.endLineAction, |
|
386 |
"shift HOME", DefaultEditorKit.selectionBeginLineAction, |
|
387 |
"shift END", DefaultEditorKit.selectionEndLineAction, |
|
388 |
"BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
389 |
"shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
390 |
"ctrl H", DefaultEditorKit.deletePrevCharAction, |
|
391 |
"DELETE", DefaultEditorKit.deleteNextCharAction, |
|
392 |
"RIGHT", DefaultEditorKit.forwardAction, |
|
393 |
"LEFT", DefaultEditorKit.backwardAction, |
|
394 |
"KP_RIGHT", DefaultEditorKit.forwardAction, |
|
395 |
"KP_LEFT", DefaultEditorKit.backwardAction, |
|
396 |
"ENTER", JTextField.notifyAction, |
|
397 |
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/ |
|
398 |
}); |
|
399 |
||
400 |
Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] { |
|
401 |
"control C", DefaultEditorKit.copyAction, |
|
402 |
"control V", DefaultEditorKit.pasteAction, |
|
403 |
"control X", DefaultEditorKit.cutAction, |
|
404 |
"COPY", DefaultEditorKit.copyAction, |
|
405 |
"PASTE", DefaultEditorKit.pasteAction, |
|
406 |
"CUT", DefaultEditorKit.cutAction, |
|
407 |
"control INSERT", DefaultEditorKit.copyAction, |
|
408 |
"shift INSERT", DefaultEditorKit.pasteAction, |
|
409 |
"shift DELETE", DefaultEditorKit.cutAction, |
|
410 |
"shift LEFT", DefaultEditorKit.selectionBackwardAction, |
|
411 |
"shift RIGHT", DefaultEditorKit.selectionForwardAction, |
|
412 |
"control LEFT", DefaultEditorKit.previousWordAction, |
|
413 |
"control RIGHT", DefaultEditorKit.nextWordAction, |
|
414 |
"control shift LEFT", DefaultEditorKit.selectionPreviousWordAction, |
|
415 |
"control shift RIGHT", DefaultEditorKit.selectionNextWordAction, |
|
416 |
"control A", DefaultEditorKit.selectAllAction, |
|
417 |
"control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/, |
|
418 |
"HOME", DefaultEditorKit.beginLineAction, |
|
419 |
"END", DefaultEditorKit.endLineAction, |
|
420 |
"shift HOME", DefaultEditorKit.selectionBeginLineAction, |
|
421 |
"shift END", DefaultEditorKit.selectionEndLineAction, |
|
422 |
"control HOME", DefaultEditorKit.beginAction, |
|
423 |
"control END", DefaultEditorKit.endAction, |
|
424 |
"control shift HOME", DefaultEditorKit.selectionBeginAction, |
|
425 |
"control shift END", DefaultEditorKit.selectionEndAction, |
|
426 |
"UP", DefaultEditorKit.upAction, |
|
427 |
"DOWN", DefaultEditorKit.downAction, |
|
428 |
"BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
429 |
"shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
430 |
"ctrl H", DefaultEditorKit.deletePrevCharAction, |
|
431 |
"DELETE", DefaultEditorKit.deleteNextCharAction, |
|
432 |
"ctrl DELETE", DefaultEditorKit.deleteNextWordAction, |
|
433 |
"ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction, |
|
434 |
"RIGHT", DefaultEditorKit.forwardAction, |
|
435 |
"LEFT", DefaultEditorKit.backwardAction, |
|
436 |
"KP_RIGHT", DefaultEditorKit.forwardAction, |
|
437 |
"KP_LEFT", DefaultEditorKit.backwardAction, |
|
438 |
"PAGE_UP", DefaultEditorKit.pageUpAction, |
|
439 |
"PAGE_DOWN", DefaultEditorKit.pageDownAction, |
|
440 |
"shift PAGE_UP", "selection-page-up", |
|
441 |
"shift PAGE_DOWN", "selection-page-down", |
|
442 |
"ctrl shift PAGE_UP", "selection-page-left", |
|
443 |
"ctrl shift PAGE_DOWN", "selection-page-right", |
|
444 |
"shift UP", DefaultEditorKit.selectionUpAction, |
|
445 |
"shift DOWN", DefaultEditorKit.selectionDownAction, |
|
446 |
"ENTER", DefaultEditorKit.insertBreakAction, |
|
447 |
"TAB", DefaultEditorKit.insertTabAction, |
|
448 |
"control T", "next-link-action", |
|
449 |
"control shift T", "previous-link-action", |
|
450 |
"control SPACE", "activate-link-action", |
|
451 |
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/ |
|
452 |
}); |
|
453 |
||
454 |
Object menuItemAcceleratorDelimiter = "+"; |
|
455 |
||
456 |
Object ControlBackgroundColor = new DesktopProperty( |
|
457 |
"win.3d.backgroundColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
458 |
table.get("control")); |
2 | 459 |
Object ControlLightColor = new DesktopProperty( |
460 |
"win.3d.lightColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
461 |
table.get("controlHighlight")); |
2 | 462 |
Object ControlHighlightColor = new DesktopProperty( |
463 |
"win.3d.highlightColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
464 |
table.get("controlLtHighlight")); |
2 | 465 |
Object ControlShadowColor = new DesktopProperty( |
466 |
"win.3d.shadowColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
467 |
table.get("controlShadow")); |
2 | 468 |
Object ControlDarkShadowColor = new DesktopProperty( |
469 |
"win.3d.darkShadowColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
470 |
table.get("controlDkShadow")); |
2 | 471 |
Object ControlTextColor = new DesktopProperty( |
472 |
"win.button.textColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
473 |
table.get("controlText")); |
2 | 474 |
Object MenuBackgroundColor = new DesktopProperty( |
475 |
"win.menu.backgroundColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
476 |
table.get("menu")); |
2 | 477 |
Object MenuBarBackgroundColor = new DesktopProperty( |
478 |
"win.menubar.backgroundColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
479 |
table.get("menu")); |
2 | 480 |
Object MenuTextColor = new DesktopProperty( |
481 |
"win.menu.textColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
482 |
table.get("menuText")); |
2 | 483 |
Object SelectionBackgroundColor = new DesktopProperty( |
484 |
"win.item.highlightColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
485 |
table.get("textHighlight")); |
2 | 486 |
Object SelectionTextColor = new DesktopProperty( |
487 |
"win.item.highlightTextColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
488 |
table.get("textHighlightText")); |
2 | 489 |
Object WindowBackgroundColor = new DesktopProperty( |
490 |
"win.frame.backgroundColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
491 |
table.get("window")); |
2 | 492 |
Object WindowTextColor = new DesktopProperty( |
493 |
"win.frame.textColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
494 |
table.get("windowText")); |
2 | 495 |
Object WindowBorderWidth = new DesktopProperty( |
496 |
"win.frame.sizingBorderWidth", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
497 |
Integer.valueOf(1)); |
2 | 498 |
Object TitlePaneHeight = new DesktopProperty( |
499 |
"win.frame.captionHeight", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
500 |
Integer.valueOf(18)); |
2 | 501 |
Object TitleButtonWidth = new DesktopProperty( |
502 |
"win.frame.captionButtonWidth", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
503 |
Integer.valueOf(16)); |
2 | 504 |
Object TitleButtonHeight = new DesktopProperty( |
505 |
"win.frame.captionButtonHeight", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
506 |
Integer.valueOf(16)); |
2 | 507 |
Object InactiveTextColor = new DesktopProperty( |
508 |
"win.text.grayedTextColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
509 |
table.get("textInactiveText")); |
2 | 510 |
Object ScrollbarBackgroundColor = new DesktopProperty( |
511 |
"win.scrollbar.backgroundColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
512 |
table.get("scrollbar")); |
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
513 |
Object buttonFocusColor = new FocusColorProperty(); |
2 | 514 |
|
515 |
Object TextBackground = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR, |
|
516 |
WindowBackgroundColor); |
|
517 |
//The following four lines were commented out as part of bug 4991597 |
|
518 |
//This code *is* correct, however it differs from WindowsXP and is, apparently |
|
519 |
//a Windows XP bug. Until Windows fixes this bug, we shall also exhibit the same |
|
520 |
//behavior |
|
521 |
//Object ReadOnlyTextBackground = new XPColorValue(Part.EP_EDITTEXT, State.READONLY, Prop.FILLCOLOR, |
|
522 |
// ControlBackgroundColor); |
|
523 |
//Object DisabledTextBackground = new XPColorValue(Part.EP_EDITTEXT, State.DISABLED, Prop.FILLCOLOR, |
|
524 |
// ControlBackgroundColor); |
|
525 |
Object ReadOnlyTextBackground = ControlBackgroundColor; |
|
526 |
Object DisabledTextBackground = ControlBackgroundColor; |
|
527 |
||
528 |
Object MenuFont = dialogPlain12; |
|
529 |
Object FixedControlFont = monospacedPlain12; |
|
530 |
Object ControlFont = dialogPlain12; |
|
531 |
Object MessageFont = dialogPlain12; |
|
532 |
Object WindowFont = dialogBold12; |
|
533 |
Object ToolTipFont = sansSerifPlain12; |
|
534 |
Object IconFont = ControlFont; |
|
535 |
||
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
536 |
Object scrollBarWidth = new DesktopProperty("win.scrollbar.width", Integer.valueOf(16)); |
2 | 537 |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
538 |
Object menuBarHeight = new DesktopProperty("win.menu.height", null); |
2 | 539 |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
540 |
Object hotTrackingOn = new DesktopProperty("win.item.hotTrackingOn", true); |
2 | 541 |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
542 |
Object showMnemonics = new DesktopProperty("win.menu.keyboardCuesOn", Boolean.TRUE); |
2 | 543 |
|
544 |
if (useSystemFontSettings) { |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
545 |
MenuFont = getDesktopFontValue("win.menu.font", MenuFont); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
546 |
FixedControlFont = getDesktopFontValue("win.ansiFixed.font", FixedControlFont); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
547 |
ControlFont = getDesktopFontValue("win.defaultGUI.font", ControlFont); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
548 |
MessageFont = getDesktopFontValue("win.messagebox.font", MessageFont); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
549 |
WindowFont = getDesktopFontValue("win.frame.captionFont", WindowFont); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
550 |
IconFont = getDesktopFontValue("win.icon.font", IconFont); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
551 |
ToolTipFont = getDesktopFontValue("win.tooltip.font", ToolTipFont); |
2 | 552 |
|
553 |
/* Put the desktop AA settings in the defaults. |
|
554 |
* JComponent.setUI() retrieves this and makes it available |
|
555 |
* as a client property on the JComponent. Use the same key name |
|
556 |
* for both client property and UIDefaults. |
|
557 |
* Also need to set up listeners for changes in these settings. |
|
558 |
*/ |
|
559 |
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true); |
|
560 |
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo); |
|
561 |
this.aaSettings = |
|
562 |
new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS); |
|
563 |
} |
|
564 |
if (useSystemFontSizeSettings) { |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
565 |
MenuFont = new WindowsFontSizeProperty("win.menu.font.height", Font.DIALOG, Font.PLAIN, 12); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
566 |
FixedControlFont = new WindowsFontSizeProperty("win.ansiFixed.font.height", Font.MONOSPACED, |
2 | 567 |
Font.PLAIN, 12); |
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
568 |
ControlFont = new WindowsFontSizeProperty("win.defaultGUI.font.height", Font.DIALOG, Font.PLAIN, 12); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
569 |
MessageFont = new WindowsFontSizeProperty("win.messagebox.font.height", Font.DIALOG, Font.PLAIN, 12); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
570 |
WindowFont = new WindowsFontSizeProperty("win.frame.captionFont.height", Font.DIALOG, Font.BOLD, 12); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
571 |
ToolTipFont = new WindowsFontSizeProperty("win.tooltip.font.height", Font.SANS_SERIF, Font.PLAIN, 12); |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
572 |
IconFont = new WindowsFontSizeProperty("win.icon.font.height", Font.DIALOG, Font.PLAIN, 12); |
2 | 573 |
} |
574 |
||
575 |
||
576 |
if (!(this instanceof WindowsClassicLookAndFeel) && |
|
577 |
(OSInfo.getOSType() == OSInfo.OSType.WINDOWS && |
|
578 |
OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0) && |
|
579 |
AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) { |
|
580 |
||
581 |
// These desktop properties are not used directly, but are needed to |
|
582 |
// trigger realoading of UI's. |
|
583 |
this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive"); |
|
584 |
this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName"); |
|
585 |
this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName"); |
|
586 |
this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName"); |
|
587 |
} |
|
588 |
||
589 |
||
590 |
Object[] defaults = { |
|
591 |
// *** Auditory Feedback |
|
592 |
// this key defines which of the various cues to render |
|
593 |
// Overridden from BasicL&F. This L&F should play all sounds |
|
594 |
// all the time. The infrastructure decides what to play. |
|
595 |
// This is disabled until sound bugs can be resolved. |
|
596 |
"AuditoryCues.playList", null, // table.get("AuditoryCues.cueList"), |
|
597 |
||
598 |
"Application.useSystemFontSettings", Boolean.valueOf(useSystemFontSettings), |
|
599 |
||
600 |
"TextField.focusInputMap", fieldInputMap, |
|
601 |
"PasswordField.focusInputMap", passwordInputMap, |
|
602 |
"TextArea.focusInputMap", multilineInputMap, |
|
603 |
"TextPane.focusInputMap", multilineInputMap, |
|
604 |
"EditorPane.focusInputMap", multilineInputMap, |
|
605 |
||
606 |
// Buttons |
|
607 |
"Button.font", ControlFont, |
|
608 |
"Button.background", ControlBackgroundColor, |
|
609 |
// Button.foreground, Button.shadow, Button.darkShadow, |
|
610 |
// Button.disabledForground, and Button.disabledShadow are only |
|
611 |
// used for Windows Classic. Windows XP will use colors |
|
612 |
// from the current visual style. |
|
613 |
"Button.foreground", ControlTextColor, |
|
614 |
"Button.shadow", ControlShadowColor, |
|
615 |
"Button.darkShadow", ControlDarkShadowColor, |
|
616 |
"Button.light", ControlLightColor, |
|
617 |
"Button.highlight", ControlHighlightColor, |
|
618 |
"Button.disabledForeground", InactiveTextColor, |
|
619 |
"Button.disabledShadow", ControlHighlightColor, |
|
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
620 |
"Button.focus", buttonFocusColor, |
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
621 |
"Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
622 |
"Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
623 |
"Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
624 |
"Button.dashedRectGapHeight", new XPValue(Integer.valueOf(6), Integer.valueOf(8)), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
625 |
"Button.textShiftOffset", new XPValue(Integer.valueOf(0), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
626 |
Integer.valueOf(1)), |
2 | 627 |
// W2K keyboard navigation hidding. |
628 |
"Button.showMnemonics", showMnemonics, |
|
629 |
"Button.focusInputMap", |
|
630 |
new UIDefaults.LazyInputMap(new Object[] { |
|
631 |
"SPACE", "pressed", |
|
632 |
"released SPACE", "released" |
|
633 |
}), |
|
634 |
||
13779
011727a60840
6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents:
11975
diff
changeset
|
635 |
"Caret.width", |
011727a60840
6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents:
11975
diff
changeset
|
636 |
new DesktopProperty("win.caret.width", null), |
011727a60840
6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents:
11975
diff
changeset
|
637 |
|
2 | 638 |
"CheckBox.font", ControlFont, |
639 |
"CheckBox.interiorBackground", WindowBackgroundColor, |
|
640 |
"CheckBox.background", ControlBackgroundColor, |
|
641 |
"CheckBox.foreground", WindowTextColor, |
|
642 |
"CheckBox.shadow", ControlShadowColor, |
|
643 |
"CheckBox.darkShadow", ControlDarkShadowColor, |
|
644 |
"CheckBox.light", ControlLightColor, |
|
645 |
"CheckBox.highlight", ControlHighlightColor, |
|
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
646 |
"CheckBox.focus", buttonFocusColor, |
2 | 647 |
"CheckBox.focusInputMap", |
648 |
new UIDefaults.LazyInputMap(new Object[] { |
|
649 |
"SPACE", "pressed", |
|
650 |
"released SPACE", "released" |
|
651 |
}), |
|
652 |
// margin is 2 all the way around, BasicBorders.RadioButtonBorder |
|
653 |
// (checkbox uses RadioButtonBorder) is 2 all the way around too. |
|
654 |
"CheckBox.totalInsets", new Insets(4, 4, 4, 4), |
|
655 |
||
656 |
"CheckBoxMenuItem.font", MenuFont, |
|
657 |
"CheckBoxMenuItem.background", MenuBackgroundColor, |
|
658 |
"CheckBoxMenuItem.foreground", MenuTextColor, |
|
659 |
"CheckBoxMenuItem.selectionForeground", SelectionTextColor, |
|
660 |
"CheckBoxMenuItem.selectionBackground", SelectionBackgroundColor, |
|
661 |
"CheckBoxMenuItem.acceleratorForeground", MenuTextColor, |
|
662 |
"CheckBoxMenuItem.acceleratorSelectionForeground", SelectionTextColor, |
|
663 |
"CheckBoxMenuItem.commandSound", "win.sound.menuCommand", |
|
664 |
||
665 |
"ComboBox.font", ControlFont, |
|
666 |
"ComboBox.background", WindowBackgroundColor, |
|
667 |
"ComboBox.foreground", WindowTextColor, |
|
668 |
"ComboBox.buttonBackground", ControlBackgroundColor, |
|
669 |
"ComboBox.buttonShadow", ControlShadowColor, |
|
670 |
"ComboBox.buttonDarkShadow", ControlDarkShadowColor, |
|
671 |
"ComboBox.buttonHighlight", ControlHighlightColor, |
|
672 |
"ComboBox.selectionBackground", SelectionBackgroundColor, |
|
673 |
"ComboBox.selectionForeground", SelectionTextColor, |
|
674 |
"ComboBox.editorBorder", new XPValue(new EmptyBorder(1,2,1,1), |
|
675 |
new EmptyBorder(1,4,1,4)), |
|
676 |
"ComboBox.disabledBackground", |
|
677 |
new XPColorValue(Part.CP_COMBOBOX, State.DISABLED, |
|
678 |
Prop.FILLCOLOR, DisabledTextBackground), |
|
679 |
"ComboBox.disabledForeground", |
|
680 |
new XPColorValue(Part.CP_COMBOBOX, State.DISABLED, |
|
681 |
Prop.TEXTCOLOR, InactiveTextColor), |
|
682 |
"ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { |
|
683 |
"ESCAPE", "hidePopup", |
|
684 |
"PAGE_UP", "pageUpPassThrough", |
|
685 |
"PAGE_DOWN", "pageDownPassThrough", |
|
686 |
"HOME", "homePassThrough", |
|
687 |
"END", "endPassThrough", |
|
688 |
"DOWN", "selectNext2", |
|
689 |
"KP_DOWN", "selectNext2", |
|
690 |
"UP", "selectPrevious2", |
|
691 |
"KP_UP", "selectPrevious2", |
|
692 |
"ENTER", "enterPressed", |
|
693 |
"F4", "togglePopup", |
|
694 |
"alt DOWN", "togglePopup", |
|
695 |
"alt KP_DOWN", "togglePopup", |
|
696 |
"alt UP", "togglePopup", |
|
697 |
"alt KP_UP", "togglePopup" |
|
698 |
}), |
|
699 |
||
700 |
// DeskTop. |
|
701 |
"Desktop.background", new DesktopProperty( |
|
702 |
"win.desktop.backgroundColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
703 |
table.get("desktop")), |
2 | 704 |
"Desktop.ancestorInputMap", |
705 |
new UIDefaults.LazyInputMap(new Object[] { |
|
706 |
"ctrl F5", "restore", |
|
707 |
"ctrl F4", "close", |
|
708 |
"ctrl F7", "move", |
|
709 |
"ctrl F8", "resize", |
|
710 |
"RIGHT", "right", |
|
711 |
"KP_RIGHT", "right", |
|
712 |
"LEFT", "left", |
|
713 |
"KP_LEFT", "left", |
|
714 |
"UP", "up", |
|
715 |
"KP_UP", "up", |
|
716 |
"DOWN", "down", |
|
717 |
"KP_DOWN", "down", |
|
718 |
"ESCAPE", "escape", |
|
719 |
"ctrl F9", "minimize", |
|
720 |
"ctrl F10", "maximize", |
|
721 |
"ctrl F6", "selectNextFrame", |
|
722 |
"ctrl TAB", "selectNextFrame", |
|
723 |
"ctrl alt F6", "selectNextFrame", |
|
724 |
"shift ctrl alt F6", "selectPreviousFrame", |
|
725 |
"ctrl F12", "navigateNext", |
|
726 |
"shift ctrl F12", "navigatePrevious" |
|
727 |
}), |
|
728 |
||
729 |
// DesktopIcon |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
730 |
"DesktopIcon.width", Integer.valueOf(160), |
2 | 731 |
|
732 |
"EditorPane.font", ControlFont, |
|
733 |
"EditorPane.background", WindowBackgroundColor, |
|
734 |
"EditorPane.foreground", WindowTextColor, |
|
735 |
"EditorPane.selectionBackground", SelectionBackgroundColor, |
|
736 |
"EditorPane.selectionForeground", SelectionTextColor, |
|
737 |
"EditorPane.caretForeground", WindowTextColor, |
|
738 |
"EditorPane.inactiveForeground", InactiveTextColor, |
|
739 |
"EditorPane.inactiveBackground", WindowBackgroundColor, |
|
740 |
"EditorPane.disabledBackground", DisabledTextBackground, |
|
741 |
||
742 |
"FileChooser.homeFolderIcon", new LazyWindowsIcon(null, |
|
743 |
"icons/HomeFolder.gif"), |
|
744 |
"FileChooser.listFont", IconFont, |
|
745 |
"FileChooser.listViewBackground", new XPColorValue(Part.LVP_LISTVIEW, null, Prop.FILLCOLOR, |
|
746 |
WindowBackgroundColor), |
|
747 |
"FileChooser.listViewBorder", new XPBorderValue(Part.LVP_LISTVIEW, |
|
23612 | 748 |
(LazyValue) t -> BorderUIResource.getLoweredBevelBorderUIResource()), |
2 | 749 |
"FileChooser.listViewIcon", new LazyWindowsIcon("fileChooserIcon ListView", |
750 |
"icons/ListView.gif"), |
|
751 |
"FileChooser.listViewWindowsStyle", Boolean.TRUE, |
|
752 |
"FileChooser.detailsViewIcon", new LazyWindowsIcon("fileChooserIcon DetailsView", |
|
753 |
"icons/DetailsView.gif"), |
|
754 |
"FileChooser.viewMenuIcon", new LazyWindowsIcon("fileChooserIcon ViewMenu", |
|
755 |
"icons/ListView.gif"), |
|
756 |
"FileChooser.upFolderIcon", new LazyWindowsIcon("fileChooserIcon UpFolder", |
|
757 |
"icons/UpFolder.gif"), |
|
758 |
"FileChooser.newFolderIcon", new LazyWindowsIcon("fileChooserIcon NewFolder", |
|
759 |
"icons/NewFolder.gif"), |
|
760 |
"FileChooser.useSystemExtensionHiding", Boolean.TRUE, |
|
761 |
||
762 |
"FileChooser.usesSingleFilePane", Boolean.TRUE, |
|
763 |
"FileChooser.noPlacesBar", new DesktopProperty("win.comdlg.noPlacesBar", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
764 |
Boolean.FALSE), |
2 | 765 |
"FileChooser.ancestorInputMap", |
766 |
new UIDefaults.LazyInputMap(new Object[] { |
|
767 |
"ESCAPE", "cancelSelection", |
|
768 |
"F2", "editFileName", |
|
769 |
"F5", "refresh", |
|
680
eaff686e34f7
5035693: "Open" button should be a default one in JFileChooser under Windows XP LAF
rupashka
parents:
438
diff
changeset
|
770 |
"BACK_SPACE", "Go Up" |
2 | 771 |
}), |
772 |
||
773 |
"FileView.directoryIcon", SwingUtilities2.makeIcon(getClass(), |
|
774 |
WindowsLookAndFeel.class, |
|
775 |
"icons/Directory.gif"), |
|
776 |
"FileView.fileIcon", SwingUtilities2.makeIcon(getClass(), |
|
777 |
WindowsLookAndFeel.class, |
|
778 |
"icons/File.gif"), |
|
779 |
"FileView.computerIcon", SwingUtilities2.makeIcon(getClass(), |
|
780 |
WindowsLookAndFeel.class, |
|
781 |
"icons/Computer.gif"), |
|
782 |
"FileView.hardDriveIcon", SwingUtilities2.makeIcon(getClass(), |
|
783 |
WindowsLookAndFeel.class, |
|
784 |
"icons/HardDrive.gif"), |
|
785 |
"FileView.floppyDriveIcon", SwingUtilities2.makeIcon(getClass(), |
|
786 |
WindowsLookAndFeel.class, |
|
787 |
"icons/FloppyDrive.gif"), |
|
788 |
||
789 |
"FormattedTextField.font", ControlFont, |
|
790 |
"InternalFrame.titleFont", WindowFont, |
|
791 |
"InternalFrame.titlePaneHeight", TitlePaneHeight, |
|
792 |
"InternalFrame.titleButtonWidth", TitleButtonWidth, |
|
793 |
"InternalFrame.titleButtonHeight", TitleButtonHeight, |
|
794 |
"InternalFrame.titleButtonToolTipsOn", hotTrackingOn, |
|
795 |
"InternalFrame.borderColor", ControlBackgroundColor, |
|
796 |
"InternalFrame.borderShadow", ControlShadowColor, |
|
797 |
"InternalFrame.borderDarkShadow", ControlDarkShadowColor, |
|
798 |
"InternalFrame.borderHighlight", ControlHighlightColor, |
|
799 |
"InternalFrame.borderLight", ControlLightColor, |
|
800 |
"InternalFrame.borderWidth", WindowBorderWidth, |
|
801 |
"InternalFrame.minimizeIconBackground", ControlBackgroundColor, |
|
802 |
"InternalFrame.resizeIconHighlight", ControlLightColor, |
|
803 |
"InternalFrame.resizeIconShadow", ControlShadowColor, |
|
804 |
"InternalFrame.activeBorderColor", new DesktopProperty( |
|
805 |
"win.frame.activeBorderColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
806 |
table.get("windowBorder")), |
2 | 807 |
"InternalFrame.inactiveBorderColor", new DesktopProperty( |
808 |
"win.frame.inactiveBorderColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
809 |
table.get("windowBorder")), |
2 | 810 |
"InternalFrame.activeTitleBackground", new DesktopProperty( |
811 |
"win.frame.activeCaptionColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
812 |
table.get("activeCaption")), |
2 | 813 |
"InternalFrame.activeTitleGradient", new DesktopProperty( |
814 |
"win.frame.activeCaptionGradientColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
815 |
table.get("activeCaption")), |
2 | 816 |
"InternalFrame.activeTitleForeground", new DesktopProperty( |
817 |
"win.frame.captionTextColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
818 |
table.get("activeCaptionText")), |
2 | 819 |
"InternalFrame.inactiveTitleBackground", new DesktopProperty( |
820 |
"win.frame.inactiveCaptionColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
821 |
table.get("inactiveCaption")), |
2 | 822 |
"InternalFrame.inactiveTitleGradient", new DesktopProperty( |
823 |
"win.frame.inactiveCaptionGradientColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
824 |
table.get("inactiveCaption")), |
2 | 825 |
"InternalFrame.inactiveTitleForeground", new DesktopProperty( |
826 |
"win.frame.inactiveCaptionTextColor", |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
827 |
table.get("inactiveCaptionText")), |
2 | 828 |
|
829 |
"InternalFrame.maximizeIcon", |
|
830 |
WindowsIconFactory.createFrameMaximizeIcon(), |
|
831 |
"InternalFrame.minimizeIcon", |
|
832 |
WindowsIconFactory.createFrameMinimizeIcon(), |
|
833 |
"InternalFrame.iconifyIcon", |
|
834 |
WindowsIconFactory.createFrameIconifyIcon(), |
|
835 |
"InternalFrame.closeIcon", |
|
836 |
WindowsIconFactory.createFrameCloseIcon(), |
|
837 |
"InternalFrame.icon", |
|
32484
e07799997e1f
8133926: No frame icon for InternalFrame in Windows LaF
serb
parents:
31653
diff
changeset
|
838 |
(LazyValue) t -> new WindowsInternalFrameTitlePane.ScalableIconUIResource(new Object[]{ |
2 | 839 |
// The constructor takes one arg: an array of UIDefaults.LazyValue |
840 |
// representing the icons |
|
841 |
SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"), |
|
842 |
SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png") |
|
32484
e07799997e1f
8133926: No frame icon for InternalFrame in Windows LaF
serb
parents:
31653
diff
changeset
|
843 |
}), |
2 | 844 |
// Internal Frame Auditory Cue Mappings |
845 |
"InternalFrame.closeSound", "win.sound.close", |
|
846 |
"InternalFrame.maximizeSound", "win.sound.maximize", |
|
847 |
"InternalFrame.minimizeSound", "win.sound.minimize", |
|
848 |
"InternalFrame.restoreDownSound", "win.sound.restoreDown", |
|
849 |
"InternalFrame.restoreUpSound", "win.sound.restoreUp", |
|
850 |
||
851 |
"InternalFrame.windowBindings", new Object[] { |
|
852 |
"shift ESCAPE", "showSystemMenu", |
|
853 |
"ctrl SPACE", "showSystemMenu", |
|
854 |
"ESCAPE", "hideSystemMenu"}, |
|
855 |
||
856 |
// Label |
|
857 |
"Label.font", ControlFont, |
|
858 |
"Label.background", ControlBackgroundColor, |
|
859 |
"Label.foreground", WindowTextColor, |
|
860 |
"Label.disabledForeground", InactiveTextColor, |
|
861 |
"Label.disabledShadow", ControlHighlightColor, |
|
862 |
||
863 |
// List. |
|
864 |
"List.font", ControlFont, |
|
865 |
"List.background", WindowBackgroundColor, |
|
866 |
"List.foreground", WindowTextColor, |
|
867 |
"List.selectionBackground", SelectionBackgroundColor, |
|
868 |
"List.selectionForeground", SelectionTextColor, |
|
869 |
"List.lockToPositionOnScroll", Boolean.TRUE, |
|
870 |
"List.focusInputMap", |
|
871 |
new UIDefaults.LazyInputMap(new Object[] { |
|
872 |
"ctrl C", "copy", |
|
873 |
"ctrl V", "paste", |
|
874 |
"ctrl X", "cut", |
|
875 |
"COPY", "copy", |
|
876 |
"PASTE", "paste", |
|
877 |
"CUT", "cut", |
|
878 |
"control INSERT", "copy", |
|
879 |
"shift INSERT", "paste", |
|
880 |
"shift DELETE", "cut", |
|
881 |
"UP", "selectPreviousRow", |
|
882 |
"KP_UP", "selectPreviousRow", |
|
883 |
"shift UP", "selectPreviousRowExtendSelection", |
|
884 |
"shift KP_UP", "selectPreviousRowExtendSelection", |
|
885 |
"ctrl shift UP", "selectPreviousRowExtendSelection", |
|
886 |
"ctrl shift KP_UP", "selectPreviousRowExtendSelection", |
|
887 |
"ctrl UP", "selectPreviousRowChangeLead", |
|
888 |
"ctrl KP_UP", "selectPreviousRowChangeLead", |
|
889 |
"DOWN", "selectNextRow", |
|
890 |
"KP_DOWN", "selectNextRow", |
|
891 |
"shift DOWN", "selectNextRowExtendSelection", |
|
892 |
"shift KP_DOWN", "selectNextRowExtendSelection", |
|
893 |
"ctrl shift DOWN", "selectNextRowExtendSelection", |
|
894 |
"ctrl shift KP_DOWN", "selectNextRowExtendSelection", |
|
895 |
"ctrl DOWN", "selectNextRowChangeLead", |
|
896 |
"ctrl KP_DOWN", "selectNextRowChangeLead", |
|
897 |
"LEFT", "selectPreviousColumn", |
|
898 |
"KP_LEFT", "selectPreviousColumn", |
|
899 |
"shift LEFT", "selectPreviousColumnExtendSelection", |
|
900 |
"shift KP_LEFT", "selectPreviousColumnExtendSelection", |
|
901 |
"ctrl shift LEFT", "selectPreviousColumnExtendSelection", |
|
902 |
"ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", |
|
903 |
"ctrl LEFT", "selectPreviousColumnChangeLead", |
|
904 |
"ctrl KP_LEFT", "selectPreviousColumnChangeLead", |
|
905 |
"RIGHT", "selectNextColumn", |
|
906 |
"KP_RIGHT", "selectNextColumn", |
|
907 |
"shift RIGHT", "selectNextColumnExtendSelection", |
|
908 |
"shift KP_RIGHT", "selectNextColumnExtendSelection", |
|
909 |
"ctrl shift RIGHT", "selectNextColumnExtendSelection", |
|
910 |
"ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", |
|
911 |
"ctrl RIGHT", "selectNextColumnChangeLead", |
|
912 |
"ctrl KP_RIGHT", "selectNextColumnChangeLead", |
|
913 |
"HOME", "selectFirstRow", |
|
914 |
"shift HOME", "selectFirstRowExtendSelection", |
|
915 |
"ctrl shift HOME", "selectFirstRowExtendSelection", |
|
916 |
"ctrl HOME", "selectFirstRowChangeLead", |
|
917 |
"END", "selectLastRow", |
|
918 |
"shift END", "selectLastRowExtendSelection", |
|
919 |
"ctrl shift END", "selectLastRowExtendSelection", |
|
920 |
"ctrl END", "selectLastRowChangeLead", |
|
921 |
"PAGE_UP", "scrollUp", |
|
922 |
"shift PAGE_UP", "scrollUpExtendSelection", |
|
923 |
"ctrl shift PAGE_UP", "scrollUpExtendSelection", |
|
924 |
"ctrl PAGE_UP", "scrollUpChangeLead", |
|
925 |
"PAGE_DOWN", "scrollDown", |
|
926 |
"shift PAGE_DOWN", "scrollDownExtendSelection", |
|
927 |
"ctrl shift PAGE_DOWN", "scrollDownExtendSelection", |
|
928 |
"ctrl PAGE_DOWN", "scrollDownChangeLead", |
|
929 |
"ctrl A", "selectAll", |
|
930 |
"ctrl SLASH", "selectAll", |
|
931 |
"ctrl BACK_SLASH", "clearSelection", |
|
932 |
"SPACE", "addToSelection", |
|
933 |
"ctrl SPACE", "toggleAndAnchor", |
|
934 |
"shift SPACE", "extendTo", |
|
935 |
"ctrl shift SPACE", "moveSelectionTo" |
|
936 |
}), |
|
937 |
||
938 |
// PopupMenu |
|
939 |
"PopupMenu.font", MenuFont, |
|
940 |
"PopupMenu.background", MenuBackgroundColor, |
|
941 |
"PopupMenu.foreground", MenuTextColor, |
|
942 |
"PopupMenu.popupSound", "win.sound.menuPopup", |
|
2658 | 943 |
"PopupMenu.consumeEventOnClose", Boolean.TRUE, |
2 | 944 |
|
945 |
// Menus |
|
946 |
"Menu.font", MenuFont, |
|
947 |
"Menu.foreground", MenuTextColor, |
|
948 |
"Menu.background", MenuBackgroundColor, |
|
949 |
"Menu.useMenuBarBackgroundForTopLevel", Boolean.TRUE, |
|
950 |
"Menu.selectionForeground", SelectionTextColor, |
|
951 |
"Menu.selectionBackground", SelectionBackgroundColor, |
|
952 |
"Menu.acceleratorForeground", MenuTextColor, |
|
953 |
"Menu.acceleratorSelectionForeground", SelectionTextColor, |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
954 |
"Menu.menuPopupOffsetX", Integer.valueOf(0), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
955 |
"Menu.menuPopupOffsetY", Integer.valueOf(0), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
956 |
"Menu.submenuPopupOffsetX", Integer.valueOf(-4), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
957 |
"Menu.submenuPopupOffsetY", Integer.valueOf(-3), |
2 | 958 |
"Menu.crossMenuMnemonic", Boolean.FALSE, |
959 |
"Menu.preserveTopLevelSelection", Boolean.TRUE, |
|
960 |
||
961 |
// MenuBar. |
|
962 |
"MenuBar.font", MenuFont, |
|
963 |
"MenuBar.background", new XPValue(MenuBarBackgroundColor, |
|
964 |
MenuBackgroundColor), |
|
965 |
"MenuBar.foreground", MenuTextColor, |
|
966 |
"MenuBar.shadow", ControlShadowColor, |
|
967 |
"MenuBar.highlight", ControlHighlightColor, |
|
968 |
"MenuBar.height", menuBarHeight, |
|
969 |
"MenuBar.rolloverEnabled", hotTrackingOn, |
|
970 |
"MenuBar.windowBindings", new Object[] { |
|
971 |
"F10", "takeFocus" }, |
|
972 |
||
973 |
"MenuItem.font", MenuFont, |
|
974 |
"MenuItem.acceleratorFont", MenuFont, |
|
975 |
"MenuItem.foreground", MenuTextColor, |
|
976 |
"MenuItem.background", MenuBackgroundColor, |
|
977 |
"MenuItem.selectionForeground", SelectionTextColor, |
|
978 |
"MenuItem.selectionBackground", SelectionBackgroundColor, |
|
979 |
"MenuItem.disabledForeground", InactiveTextColor, |
|
980 |
"MenuItem.acceleratorForeground", MenuTextColor, |
|
981 |
"MenuItem.acceleratorSelectionForeground", SelectionTextColor, |
|
982 |
"MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter, |
|
983 |
// Menu Item Auditory Cue Mapping |
|
984 |
"MenuItem.commandSound", "win.sound.menuCommand", |
|
985 |
// indicates that keyboard navigation won't skip disabled menu items |
|
986 |
"MenuItem.disabledAreNavigable", Boolean.TRUE, |
|
987 |
||
988 |
"RadioButton.font", ControlFont, |
|
989 |
"RadioButton.interiorBackground", WindowBackgroundColor, |
|
990 |
"RadioButton.background", ControlBackgroundColor, |
|
991 |
"RadioButton.foreground", WindowTextColor, |
|
992 |
"RadioButton.shadow", ControlShadowColor, |
|
993 |
"RadioButton.darkShadow", ControlDarkShadowColor, |
|
994 |
"RadioButton.light", ControlLightColor, |
|
995 |
"RadioButton.highlight", ControlHighlightColor, |
|
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
996 |
"RadioButton.focus", buttonFocusColor, |
2 | 997 |
"RadioButton.focusInputMap", |
998 |
new UIDefaults.LazyInputMap(new Object[] { |
|
999 |
"SPACE", "pressed", |
|
1000 |
"released SPACE", "released" |
|
1001 |
}), |
|
1002 |
// margin is 2 all the way around, BasicBorders.RadioButtonBorder |
|
1003 |
// is 2 all the way around too. |
|
1004 |
"RadioButton.totalInsets", new Insets(4, 4, 4, 4), |
|
1005 |
||
1006 |
||
1007 |
"RadioButtonMenuItem.font", MenuFont, |
|
1008 |
"RadioButtonMenuItem.foreground", MenuTextColor, |
|
1009 |
"RadioButtonMenuItem.background", MenuBackgroundColor, |
|
1010 |
"RadioButtonMenuItem.selectionForeground", SelectionTextColor, |
|
1011 |
"RadioButtonMenuItem.selectionBackground", SelectionBackgroundColor, |
|
1012 |
"RadioButtonMenuItem.disabledForeground", InactiveTextColor, |
|
1013 |
"RadioButtonMenuItem.acceleratorForeground", MenuTextColor, |
|
1014 |
"RadioButtonMenuItem.acceleratorSelectionForeground", SelectionTextColor, |
|
1015 |
"RadioButtonMenuItem.commandSound", "win.sound.menuCommand", |
|
1016 |
||
1017 |
// OptionPane. |
|
1018 |
"OptionPane.font", MessageFont, |
|
1019 |
"OptionPane.messageFont", MessageFont, |
|
1020 |
"OptionPane.buttonFont", MessageFont, |
|
1021 |
"OptionPane.background", ControlBackgroundColor, |
|
1022 |
"OptionPane.foreground", WindowTextColor, |
|
1023 |
"OptionPane.buttonMinimumWidth", new XPDLUValue(50, 50, SwingConstants.EAST), |
|
1024 |
"OptionPane.messageForeground", ControlTextColor, |
|
1025 |
"OptionPane.errorIcon", new LazyWindowsIcon("optionPaneIcon Error", |
|
1026 |
"icons/Error.gif"), |
|
1027 |
"OptionPane.informationIcon", new LazyWindowsIcon("optionPaneIcon Information", |
|
1028 |
"icons/Inform.gif"), |
|
1029 |
"OptionPane.questionIcon", new LazyWindowsIcon("optionPaneIcon Question", |
|
1030 |
"icons/Question.gif"), |
|
1031 |
"OptionPane.warningIcon", new LazyWindowsIcon("optionPaneIcon Warning", |
|
1032 |
"icons/Warn.gif"), |
|
1033 |
"OptionPane.windowBindings", new Object[] { |
|
1034 |
"ESCAPE", "close" }, |
|
1035 |
// Option Pane Auditory Cue Mappings |
|
1036 |
"OptionPane.errorSound", "win.sound.hand", // Error |
|
1037 |
"OptionPane.informationSound", "win.sound.asterisk", // Info Plain |
|
1038 |
"OptionPane.questionSound", "win.sound.question", // Question |
|
1039 |
"OptionPane.warningSound", "win.sound.exclamation", // Warning |
|
1040 |
||
1041 |
"FormattedTextField.focusInputMap", |
|
1042 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1043 |
"ctrl C", DefaultEditorKit.copyAction, |
|
1044 |
"ctrl V", DefaultEditorKit.pasteAction, |
|
1045 |
"ctrl X", DefaultEditorKit.cutAction, |
|
1046 |
"COPY", DefaultEditorKit.copyAction, |
|
1047 |
"PASTE", DefaultEditorKit.pasteAction, |
|
1048 |
"CUT", DefaultEditorKit.cutAction, |
|
1049 |
"control INSERT", DefaultEditorKit.copyAction, |
|
1050 |
"shift INSERT", DefaultEditorKit.pasteAction, |
|
1051 |
"shift DELETE", DefaultEditorKit.cutAction, |
|
1052 |
"shift LEFT", DefaultEditorKit.selectionBackwardAction, |
|
1053 |
"shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, |
|
1054 |
"shift RIGHT", DefaultEditorKit.selectionForwardAction, |
|
1055 |
"shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, |
|
1056 |
"ctrl LEFT", DefaultEditorKit.previousWordAction, |
|
1057 |
"ctrl KP_LEFT", DefaultEditorKit.previousWordAction, |
|
1058 |
"ctrl RIGHT", DefaultEditorKit.nextWordAction, |
|
1059 |
"ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, |
|
1060 |
"ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, |
|
1061 |
"ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, |
|
1062 |
"ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, |
|
1063 |
"ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, |
|
1064 |
"ctrl A", DefaultEditorKit.selectAllAction, |
|
1065 |
"HOME", DefaultEditorKit.beginLineAction, |
|
1066 |
"END", DefaultEditorKit.endLineAction, |
|
1067 |
"shift HOME", DefaultEditorKit.selectionBeginLineAction, |
|
1068 |
"shift END", DefaultEditorKit.selectionEndLineAction, |
|
1069 |
"BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
1070 |
"shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, |
|
1071 |
"ctrl H", DefaultEditorKit.deletePrevCharAction, |
|
1072 |
"DELETE", DefaultEditorKit.deleteNextCharAction, |
|
1073 |
"ctrl DELETE", DefaultEditorKit.deleteNextWordAction, |
|
1074 |
"ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction, |
|
1075 |
"RIGHT", DefaultEditorKit.forwardAction, |
|
1076 |
"LEFT", DefaultEditorKit.backwardAction, |
|
1077 |
"KP_RIGHT", DefaultEditorKit.forwardAction, |
|
1078 |
"KP_LEFT", DefaultEditorKit.backwardAction, |
|
1079 |
"ENTER", JTextField.notifyAction, |
|
1080 |
"ctrl BACK_SLASH", "unselect", |
|
1081 |
"control shift O", "toggle-componentOrientation", |
|
1082 |
"ESCAPE", "reset-field-edit", |
|
1083 |
"UP", "increment", |
|
1084 |
"KP_UP", "increment", |
|
1085 |
"DOWN", "decrement", |
|
1086 |
"KP_DOWN", "decrement", |
|
1087 |
}), |
|
1088 |
"FormattedTextField.inactiveBackground", ReadOnlyTextBackground, |
|
1089 |
"FormattedTextField.disabledBackground", DisabledTextBackground, |
|
1090 |
||
1091 |
// *** Panel |
|
1092 |
"Panel.font", ControlFont, |
|
1093 |
"Panel.background", ControlBackgroundColor, |
|
1094 |
"Panel.foreground", WindowTextColor, |
|
1095 |
||
1096 |
// *** PasswordField |
|
1097 |
"PasswordField.font", ControlFont, |
|
1098 |
"PasswordField.background", TextBackground, |
|
1099 |
"PasswordField.foreground", WindowTextColor, |
|
1100 |
"PasswordField.inactiveForeground", InactiveTextColor, // for disabled |
|
1101 |
"PasswordField.inactiveBackground", ReadOnlyTextBackground, // for readonly |
|
1102 |
"PasswordField.disabledBackground", DisabledTextBackground, // for disabled |
|
1103 |
"PasswordField.selectionBackground", SelectionBackgroundColor, |
|
1104 |
"PasswordField.selectionForeground", SelectionTextColor, |
|
1105 |
"PasswordField.caretForeground",WindowTextColor, |
|
25187
08aff438def8
8048874: Replace uses of 'new Byte', 'new Short' and 'new Character' with appropriate alternative across core classes
prappo
parents:
25143
diff
changeset
|
1106 |
"PasswordField.echoChar", new XPValue((char)0x25CF, '*'), |
2 | 1107 |
|
1108 |
// *** ProgressBar |
|
1109 |
"ProgressBar.font", ControlFont, |
|
1110 |
"ProgressBar.foreground", SelectionBackgroundColor, |
|
1111 |
"ProgressBar.background", ControlBackgroundColor, |
|
1112 |
"ProgressBar.shadow", ControlShadowColor, |
|
1113 |
"ProgressBar.highlight", ControlHighlightColor, |
|
1114 |
"ProgressBar.selectionForeground", ControlBackgroundColor, |
|
1115 |
"ProgressBar.selectionBackground", SelectionBackgroundColor, |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
1116 |
"ProgressBar.cellLength", Integer.valueOf(7), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
1117 |
"ProgressBar.cellSpacing", Integer.valueOf(2), |
2 | 1118 |
"ProgressBar.indeterminateInsets", new Insets(3, 3, 3, 3), |
1119 |
||
1120 |
// *** RootPane. |
|
1121 |
// These bindings are only enabled when there is a default |
|
1122 |
// button set on the rootpane. |
|
1123 |
"RootPane.defaultButtonWindowKeyBindings", new Object[] { |
|
1124 |
"ENTER", "press", |
|
1125 |
"released ENTER", "release", |
|
1126 |
"ctrl ENTER", "press", |
|
1127 |
"ctrl released ENTER", "release" |
|
1128 |
}, |
|
1129 |
||
1130 |
// *** ScrollBar. |
|
1131 |
"ScrollBar.background", ScrollbarBackgroundColor, |
|
1132 |
"ScrollBar.foreground", ControlBackgroundColor, |
|
1133 |
"ScrollBar.track", white, |
|
1134 |
"ScrollBar.trackForeground", ScrollbarBackgroundColor, |
|
1135 |
"ScrollBar.trackHighlight", black, |
|
1136 |
"ScrollBar.trackHighlightForeground", scrollBarTrackHighlight, |
|
1137 |
"ScrollBar.thumb", ControlBackgroundColor, |
|
1138 |
"ScrollBar.thumbHighlight", ControlHighlightColor, |
|
1139 |
"ScrollBar.thumbDarkShadow", ControlDarkShadowColor, |
|
1140 |
"ScrollBar.thumbShadow", ControlShadowColor, |
|
1141 |
"ScrollBar.width", scrollBarWidth, |
|
1142 |
"ScrollBar.ancestorInputMap", |
|
1143 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1144 |
"RIGHT", "positiveUnitIncrement", |
|
1145 |
"KP_RIGHT", "positiveUnitIncrement", |
|
1146 |
"DOWN", "positiveUnitIncrement", |
|
1147 |
"KP_DOWN", "positiveUnitIncrement", |
|
1148 |
"PAGE_DOWN", "positiveBlockIncrement", |
|
1149 |
"ctrl PAGE_DOWN", "positiveBlockIncrement", |
|
1150 |
"LEFT", "negativeUnitIncrement", |
|
1151 |
"KP_LEFT", "negativeUnitIncrement", |
|
1152 |
"UP", "negativeUnitIncrement", |
|
1153 |
"KP_UP", "negativeUnitIncrement", |
|
1154 |
"PAGE_UP", "negativeBlockIncrement", |
|
1155 |
"ctrl PAGE_UP", "negativeBlockIncrement", |
|
1156 |
"HOME", "minScroll", |
|
1157 |
"END", "maxScroll" |
|
1158 |
}), |
|
1159 |
||
1160 |
// *** ScrollPane. |
|
1161 |
"ScrollPane.font", ControlFont, |
|
1162 |
"ScrollPane.background", ControlBackgroundColor, |
|
1163 |
"ScrollPane.foreground", ControlTextColor, |
|
1164 |
"ScrollPane.ancestorInputMap", |
|
1165 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1166 |
"RIGHT", "unitScrollRight", |
|
1167 |
"KP_RIGHT", "unitScrollRight", |
|
1168 |
"DOWN", "unitScrollDown", |
|
1169 |
"KP_DOWN", "unitScrollDown", |
|
1170 |
"LEFT", "unitScrollLeft", |
|
1171 |
"KP_LEFT", "unitScrollLeft", |
|
1172 |
"UP", "unitScrollUp", |
|
1173 |
"KP_UP", "unitScrollUp", |
|
1174 |
"PAGE_UP", "scrollUp", |
|
1175 |
"PAGE_DOWN", "scrollDown", |
|
1176 |
"ctrl PAGE_UP", "scrollLeft", |
|
1177 |
"ctrl PAGE_DOWN", "scrollRight", |
|
1178 |
"ctrl HOME", "scrollHome", |
|
1179 |
"ctrl END", "scrollEnd" |
|
1180 |
}), |
|
1181 |
||
1182 |
// *** Separator |
|
1183 |
"Separator.background", ControlHighlightColor, |
|
1184 |
"Separator.foreground", ControlShadowColor, |
|
1185 |
||
1186 |
// *** Slider. |
|
1187 |
"Slider.font", ControlFont, |
|
1188 |
"Slider.foreground", ControlBackgroundColor, |
|
1189 |
"Slider.background", ControlBackgroundColor, |
|
1190 |
"Slider.highlight", ControlHighlightColor, |
|
1191 |
"Slider.shadow", ControlShadowColor, |
|
1192 |
"Slider.focus", ControlDarkShadowColor, |
|
1193 |
"Slider.focusInputMap", |
|
1194 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1195 |
"RIGHT", "positiveUnitIncrement", |
|
1196 |
"KP_RIGHT", "positiveUnitIncrement", |
|
1197 |
"DOWN", "negativeUnitIncrement", |
|
1198 |
"KP_DOWN", "negativeUnitIncrement", |
|
1199 |
"PAGE_DOWN", "negativeBlockIncrement", |
|
1200 |
"LEFT", "negativeUnitIncrement", |
|
1201 |
"KP_LEFT", "negativeUnitIncrement", |
|
1202 |
"UP", "positiveUnitIncrement", |
|
1203 |
"KP_UP", "positiveUnitIncrement", |
|
1204 |
"PAGE_UP", "positiveBlockIncrement", |
|
1205 |
"HOME", "minScroll", |
|
1206 |
"END", "maxScroll" |
|
1207 |
}), |
|
1208 |
||
1209 |
// Spinner |
|
1210 |
"Spinner.font", ControlFont, |
|
1211 |
"Spinner.ancestorInputMap", |
|
1212 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1213 |
"UP", "increment", |
|
1214 |
"KP_UP", "increment", |
|
1215 |
"DOWN", "decrement", |
|
1216 |
"KP_DOWN", "decrement", |
|
1217 |
}), |
|
1218 |
||
1219 |
// *** SplitPane |
|
1220 |
"SplitPane.background", ControlBackgroundColor, |
|
1221 |
"SplitPane.highlight", ControlHighlightColor, |
|
1222 |
"SplitPane.shadow", ControlShadowColor, |
|
1223 |
"SplitPane.darkShadow", ControlDarkShadowColor, |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
1224 |
"SplitPane.dividerSize", Integer.valueOf(5), |
2 | 1225 |
"SplitPane.ancestorInputMap", |
1226 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1227 |
"UP", "negativeIncrement", |
|
1228 |
"DOWN", "positiveIncrement", |
|
1229 |
"LEFT", "negativeIncrement", |
|
1230 |
"RIGHT", "positiveIncrement", |
|
1231 |
"KP_UP", "negativeIncrement", |
|
1232 |
"KP_DOWN", "positiveIncrement", |
|
1233 |
"KP_LEFT", "negativeIncrement", |
|
1234 |
"KP_RIGHT", "positiveIncrement", |
|
1235 |
"HOME", "selectMin", |
|
1236 |
"END", "selectMax", |
|
1237 |
"F8", "startResize", |
|
1238 |
"F6", "toggleFocus", |
|
1239 |
"ctrl TAB", "focusOutForward", |
|
1240 |
"ctrl shift TAB", "focusOutBackward" |
|
1241 |
}), |
|
1242 |
||
1243 |
// *** TabbedPane |
|
1244 |
"TabbedPane.tabsOverlapBorder", new XPValue(Boolean.TRUE, Boolean.FALSE), |
|
1245 |
"TabbedPane.tabInsets", new XPValue(new InsetsUIResource(1, 4, 1, 4), |
|
1246 |
new InsetsUIResource(0, 4, 1, 4)), |
|
1247 |
"TabbedPane.tabAreaInsets", new XPValue(new InsetsUIResource(3, 2, 2, 2), |
|
1248 |
new InsetsUIResource(3, 2, 0, 2)), |
|
1249 |
"TabbedPane.font", ControlFont, |
|
1250 |
"TabbedPane.background", ControlBackgroundColor, |
|
1251 |
"TabbedPane.foreground", ControlTextColor, |
|
1252 |
"TabbedPane.highlight", ControlHighlightColor, |
|
1253 |
"TabbedPane.light", ControlLightColor, |
|
1254 |
"TabbedPane.shadow", ControlShadowColor, |
|
1255 |
"TabbedPane.darkShadow", ControlDarkShadowColor, |
|
1256 |
"TabbedPane.focus", ControlTextColor, |
|
1257 |
"TabbedPane.focusInputMap", |
|
1258 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1259 |
"RIGHT", "navigateRight", |
|
1260 |
"KP_RIGHT", "navigateRight", |
|
1261 |
"LEFT", "navigateLeft", |
|
1262 |
"KP_LEFT", "navigateLeft", |
|
1263 |
"UP", "navigateUp", |
|
1264 |
"KP_UP", "navigateUp", |
|
1265 |
"DOWN", "navigateDown", |
|
1266 |
"KP_DOWN", "navigateDown", |
|
1267 |
"ctrl DOWN", "requestFocusForVisibleComponent", |
|
1268 |
"ctrl KP_DOWN", "requestFocusForVisibleComponent", |
|
1269 |
}), |
|
1270 |
"TabbedPane.ancestorInputMap", |
|
1271 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1272 |
"ctrl TAB", "navigateNext", |
|
1273 |
"ctrl shift TAB", "navigatePrevious", |
|
1274 |
"ctrl PAGE_DOWN", "navigatePageDown", |
|
1275 |
"ctrl PAGE_UP", "navigatePageUp", |
|
1276 |
"ctrl UP", "requestFocus", |
|
1277 |
"ctrl KP_UP", "requestFocus", |
|
1278 |
}), |
|
1279 |
||
1280 |
// *** Table |
|
1281 |
"Table.font", ControlFont, |
|
1282 |
"Table.foreground", ControlTextColor, // cell text color |
|
1283 |
"Table.background", WindowBackgroundColor, // cell background color |
|
1284 |
"Table.highlight", ControlHighlightColor, |
|
1285 |
"Table.light", ControlLightColor, |
|
1286 |
"Table.shadow", ControlShadowColor, |
|
1287 |
"Table.darkShadow", ControlDarkShadowColor, |
|
1288 |
"Table.selectionForeground", SelectionTextColor, |
|
1289 |
"Table.selectionBackground", SelectionBackgroundColor, |
|
1290 |
"Table.gridColor", gray, // grid line color |
|
1291 |
"Table.focusCellBackground", WindowBackgroundColor, |
|
1292 |
"Table.focusCellForeground", ControlTextColor, |
|
1293 |
"Table.ancestorInputMap", |
|
1294 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1295 |
"ctrl C", "copy", |
|
1296 |
"ctrl V", "paste", |
|
1297 |
"ctrl X", "cut", |
|
1298 |
"COPY", "copy", |
|
1299 |
"PASTE", "paste", |
|
1300 |
"CUT", "cut", |
|
1301 |
"control INSERT", "copy", |
|
1302 |
"shift INSERT", "paste", |
|
1303 |
"shift DELETE", "cut", |
|
1304 |
"RIGHT", "selectNextColumn", |
|
1305 |
"KP_RIGHT", "selectNextColumn", |
|
1306 |
"shift RIGHT", "selectNextColumnExtendSelection", |
|
1307 |
"shift KP_RIGHT", "selectNextColumnExtendSelection", |
|
1308 |
"ctrl shift RIGHT", "selectNextColumnExtendSelection", |
|
1309 |
"ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", |
|
1310 |
"ctrl RIGHT", "selectNextColumnChangeLead", |
|
1311 |
"ctrl KP_RIGHT", "selectNextColumnChangeLead", |
|
1312 |
"LEFT", "selectPreviousColumn", |
|
1313 |
"KP_LEFT", "selectPreviousColumn", |
|
1314 |
"shift LEFT", "selectPreviousColumnExtendSelection", |
|
1315 |
"shift KP_LEFT", "selectPreviousColumnExtendSelection", |
|
1316 |
"ctrl shift LEFT", "selectPreviousColumnExtendSelection", |
|
1317 |
"ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", |
|
1318 |
"ctrl LEFT", "selectPreviousColumnChangeLead", |
|
1319 |
"ctrl KP_LEFT", "selectPreviousColumnChangeLead", |
|
1320 |
"DOWN", "selectNextRow", |
|
1321 |
"KP_DOWN", "selectNextRow", |
|
1322 |
"shift DOWN", "selectNextRowExtendSelection", |
|
1323 |
"shift KP_DOWN", "selectNextRowExtendSelection", |
|
1324 |
"ctrl shift DOWN", "selectNextRowExtendSelection", |
|
1325 |
"ctrl shift KP_DOWN", "selectNextRowExtendSelection", |
|
1326 |
"ctrl DOWN", "selectNextRowChangeLead", |
|
1327 |
"ctrl KP_DOWN", "selectNextRowChangeLead", |
|
1328 |
"UP", "selectPreviousRow", |
|
1329 |
"KP_UP", "selectPreviousRow", |
|
1330 |
"shift UP", "selectPreviousRowExtendSelection", |
|
1331 |
"shift KP_UP", "selectPreviousRowExtendSelection", |
|
1332 |
"ctrl shift UP", "selectPreviousRowExtendSelection", |
|
1333 |
"ctrl shift KP_UP", "selectPreviousRowExtendSelection", |
|
1334 |
"ctrl UP", "selectPreviousRowChangeLead", |
|
1335 |
"ctrl KP_UP", "selectPreviousRowChangeLead", |
|
1336 |
"HOME", "selectFirstColumn", |
|
1337 |
"shift HOME", "selectFirstColumnExtendSelection", |
|
1338 |
"ctrl shift HOME", "selectFirstRowExtendSelection", |
|
1339 |
"ctrl HOME", "selectFirstRow", |
|
1340 |
"END", "selectLastColumn", |
|
1341 |
"shift END", "selectLastColumnExtendSelection", |
|
1342 |
"ctrl shift END", "selectLastRowExtendSelection", |
|
1343 |
"ctrl END", "selectLastRow", |
|
1344 |
"PAGE_UP", "scrollUpChangeSelection", |
|
1345 |
"shift PAGE_UP", "scrollUpExtendSelection", |
|
1346 |
"ctrl shift PAGE_UP", "scrollLeftExtendSelection", |
|
1347 |
"ctrl PAGE_UP", "scrollLeftChangeSelection", |
|
1348 |
"PAGE_DOWN", "scrollDownChangeSelection", |
|
1349 |
"shift PAGE_DOWN", "scrollDownExtendSelection", |
|
1350 |
"ctrl shift PAGE_DOWN", "scrollRightExtendSelection", |
|
1351 |
"ctrl PAGE_DOWN", "scrollRightChangeSelection", |
|
1352 |
"TAB", "selectNextColumnCell", |
|
1353 |
"shift TAB", "selectPreviousColumnCell", |
|
1354 |
"ENTER", "selectNextRowCell", |
|
1355 |
"shift ENTER", "selectPreviousRowCell", |
|
1356 |
"ctrl A", "selectAll", |
|
1357 |
"ctrl SLASH", "selectAll", |
|
1358 |
"ctrl BACK_SLASH", "clearSelection", |
|
1359 |
"ESCAPE", "cancel", |
|
1360 |
"F2", "startEditing", |
|
1361 |
"SPACE", "addToSelection", |
|
1362 |
"ctrl SPACE", "toggleAndAnchor", |
|
1363 |
"shift SPACE", "extendTo", |
|
1364 |
"ctrl shift SPACE", "moveSelectionTo", |
|
1365 |
"F8", "focusHeader" |
|
1366 |
}), |
|
1367 |
"Table.sortIconHighlight", ControlShadowColor, |
|
1368 |
"Table.sortIconLight", white, |
|
1369 |
||
1370 |
"TableHeader.font", ControlFont, |
|
1371 |
"TableHeader.foreground", ControlTextColor, // header text color |
|
1372 |
"TableHeader.background", ControlBackgroundColor, // header background |
|
1373 |
"TableHeader.focusCellBackground", |
|
1374 |
new XPValue(XPValue.NULL_VALUE, // use default bg from XP styles |
|
1375 |
WindowBackgroundColor), // or white bg otherwise |
|
1376 |
||
1377 |
// *** TextArea |
|
1378 |
"TextArea.font", FixedControlFont, |
|
1379 |
"TextArea.background", WindowBackgroundColor, |
|
1380 |
"TextArea.foreground", WindowTextColor, |
|
1381 |
"TextArea.inactiveForeground", InactiveTextColor, |
|
1382 |
"TextArea.inactiveBackground", WindowBackgroundColor, |
|
1383 |
"TextArea.disabledBackground", DisabledTextBackground, |
|
1384 |
"TextArea.selectionBackground", SelectionBackgroundColor, |
|
1385 |
"TextArea.selectionForeground", SelectionTextColor, |
|
1386 |
"TextArea.caretForeground", WindowTextColor, |
|
1387 |
||
1388 |
// *** TextField |
|
1389 |
"TextField.font", ControlFont, |
|
1390 |
"TextField.background", TextBackground, |
|
1391 |
"TextField.foreground", WindowTextColor, |
|
1392 |
"TextField.shadow", ControlShadowColor, |
|
1393 |
"TextField.darkShadow", ControlDarkShadowColor, |
|
1394 |
"TextField.light", ControlLightColor, |
|
1395 |
"TextField.highlight", ControlHighlightColor, |
|
1396 |
"TextField.inactiveForeground", InactiveTextColor, // for disabled |
|
1397 |
"TextField.inactiveBackground", ReadOnlyTextBackground, // for readonly |
|
1398 |
"TextField.disabledBackground", DisabledTextBackground, // for disabled |
|
1399 |
"TextField.selectionBackground", SelectionBackgroundColor, |
|
1400 |
"TextField.selectionForeground", SelectionTextColor, |
|
1401 |
"TextField.caretForeground", WindowTextColor, |
|
1402 |
||
1403 |
// *** TextPane |
|
1404 |
"TextPane.font", ControlFont, |
|
1405 |
"TextPane.background", WindowBackgroundColor, |
|
1406 |
"TextPane.foreground", WindowTextColor, |
|
1407 |
"TextPane.selectionBackground", SelectionBackgroundColor, |
|
1408 |
"TextPane.selectionForeground", SelectionTextColor, |
|
1409 |
"TextPane.inactiveBackground", WindowBackgroundColor, |
|
1410 |
"TextPane.disabledBackground", DisabledTextBackground, |
|
1411 |
"TextPane.caretForeground", WindowTextColor, |
|
1412 |
||
1413 |
// *** TitledBorder |
|
1414 |
"TitledBorder.font", ControlFont, |
|
1415 |
"TitledBorder.titleColor", |
|
1416 |
new XPColorValue(Part.BP_GROUPBOX, null, Prop.TEXTCOLOR, |
|
1417 |
WindowTextColor), |
|
1418 |
||
1419 |
// *** ToggleButton |
|
1420 |
"ToggleButton.font", ControlFont, |
|
1421 |
"ToggleButton.background", ControlBackgroundColor, |
|
1422 |
"ToggleButton.foreground", ControlTextColor, |
|
1423 |
"ToggleButton.shadow", ControlShadowColor, |
|
1424 |
"ToggleButton.darkShadow", ControlDarkShadowColor, |
|
1425 |
"ToggleButton.light", ControlLightColor, |
|
1426 |
"ToggleButton.highlight", ControlHighlightColor, |
|
1427 |
"ToggleButton.focus", ControlTextColor, |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
1428 |
"ToggleButton.textShiftOffset", Integer.valueOf(1), |
2 | 1429 |
"ToggleButton.focusInputMap", |
1430 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1431 |
"SPACE", "pressed", |
|
1432 |
"released SPACE", "released" |
|
1433 |
}), |
|
1434 |
||
1435 |
// *** ToolBar |
|
1436 |
"ToolBar.font", MenuFont, |
|
1437 |
"ToolBar.background", ControlBackgroundColor, |
|
1438 |
"ToolBar.foreground", ControlTextColor, |
|
1439 |
"ToolBar.shadow", ControlShadowColor, |
|
1440 |
"ToolBar.darkShadow", ControlDarkShadowColor, |
|
1441 |
"ToolBar.light", ControlLightColor, |
|
1442 |
"ToolBar.highlight", ControlHighlightColor, |
|
1443 |
"ToolBar.dockingBackground", ControlBackgroundColor, |
|
1444 |
"ToolBar.dockingForeground", red, |
|
1445 |
"ToolBar.floatingBackground", ControlBackgroundColor, |
|
1446 |
"ToolBar.floatingForeground", darkGray, |
|
1447 |
"ToolBar.ancestorInputMap", |
|
1448 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1449 |
"UP", "navigateUp", |
|
1450 |
"KP_UP", "navigateUp", |
|
1451 |
"DOWN", "navigateDown", |
|
1452 |
"KP_DOWN", "navigateDown", |
|
1453 |
"LEFT", "navigateLeft", |
|
1454 |
"KP_LEFT", "navigateLeft", |
|
1455 |
"RIGHT", "navigateRight", |
|
1456 |
"KP_RIGHT", "navigateRight" |
|
1457 |
}), |
|
1458 |
"ToolBar.separatorSize", null, |
|
1459 |
||
1460 |
// *** ToolTip |
|
1461 |
"ToolTip.font", ToolTipFont, |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
1462 |
"ToolTip.background", new DesktopProperty("win.tooltip.backgroundColor", table.get("info")), |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
1463 |
"ToolTip.foreground", new DesktopProperty("win.tooltip.textColor", table.get("infoText")), |
2 | 1464 |
|
1465 |
// *** ToolTipManager |
|
1466 |
"ToolTipManager.enableToolTipMode", "activeApplication", |
|
1467 |
||
1468 |
// *** Tree |
|
1469 |
"Tree.selectionBorderColor", black, |
|
1470 |
"Tree.drawDashedFocusIndicator", Boolean.TRUE, |
|
1471 |
"Tree.lineTypeDashed", Boolean.TRUE, |
|
1472 |
"Tree.font", ControlFont, |
|
1473 |
"Tree.background", WindowBackgroundColor, |
|
1474 |
"Tree.foreground", WindowTextColor, |
|
1475 |
"Tree.hash", gray, |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
1476 |
"Tree.leftChildIndent", Integer.valueOf(8), |
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
1477 |
"Tree.rightChildIndent", Integer.valueOf(11), |
2 | 1478 |
"Tree.textForeground", WindowTextColor, |
1479 |
"Tree.textBackground", WindowBackgroundColor, |
|
1480 |
"Tree.selectionForeground", SelectionTextColor, |
|
1481 |
"Tree.selectionBackground", SelectionBackgroundColor, |
|
1482 |
"Tree.expandedIcon", treeExpandedIcon, |
|
1483 |
"Tree.collapsedIcon", treeCollapsedIcon, |
|
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
1484 |
"Tree.openIcon", new ActiveWindowsIcon("win.icon.shellIconBPP", |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
1485 |
"shell32Icon 5", "icons/TreeOpen.gif"), |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
1486 |
"Tree.closedIcon", new ActiveWindowsIcon("win.icon.shellIconBPP", |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
1487 |
"shell32Icon 4", "icons/TreeClosed.gif"), |
2 | 1488 |
"Tree.focusInputMap", |
1489 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1490 |
"ADD", "expand", |
|
1491 |
"SUBTRACT", "collapse", |
|
1492 |
"ctrl C", "copy", |
|
1493 |
"ctrl V", "paste", |
|
1494 |
"ctrl X", "cut", |
|
1495 |
"COPY", "copy", |
|
1496 |
"PASTE", "paste", |
|
1497 |
"CUT", "cut", |
|
1498 |
"control INSERT", "copy", |
|
1499 |
"shift INSERT", "paste", |
|
1500 |
"shift DELETE", "cut", |
|
1501 |
"UP", "selectPrevious", |
|
1502 |
"KP_UP", "selectPrevious", |
|
1503 |
"shift UP", "selectPreviousExtendSelection", |
|
1504 |
"shift KP_UP", "selectPreviousExtendSelection", |
|
1505 |
"ctrl shift UP", "selectPreviousExtendSelection", |
|
1506 |
"ctrl shift KP_UP", "selectPreviousExtendSelection", |
|
1507 |
"ctrl UP", "selectPreviousChangeLead", |
|
1508 |
"ctrl KP_UP", "selectPreviousChangeLead", |
|
1509 |
"DOWN", "selectNext", |
|
1510 |
"KP_DOWN", "selectNext", |
|
1511 |
"shift DOWN", "selectNextExtendSelection", |
|
1512 |
"shift KP_DOWN", "selectNextExtendSelection", |
|
1513 |
"ctrl shift DOWN", "selectNextExtendSelection", |
|
1514 |
"ctrl shift KP_DOWN", "selectNextExtendSelection", |
|
1515 |
"ctrl DOWN", "selectNextChangeLead", |
|
1516 |
"ctrl KP_DOWN", "selectNextChangeLead", |
|
1517 |
"RIGHT", "selectChild", |
|
1518 |
"KP_RIGHT", "selectChild", |
|
1519 |
"LEFT", "selectParent", |
|
1520 |
"KP_LEFT", "selectParent", |
|
1521 |
"PAGE_UP", "scrollUpChangeSelection", |
|
1522 |
"shift PAGE_UP", "scrollUpExtendSelection", |
|
1523 |
"ctrl shift PAGE_UP", "scrollUpExtendSelection", |
|
1524 |
"ctrl PAGE_UP", "scrollUpChangeLead", |
|
1525 |
"PAGE_DOWN", "scrollDownChangeSelection", |
|
1526 |
"shift PAGE_DOWN", "scrollDownExtendSelection", |
|
1527 |
"ctrl shift PAGE_DOWN", "scrollDownExtendSelection", |
|
1528 |
"ctrl PAGE_DOWN", "scrollDownChangeLead", |
|
1529 |
"HOME", "selectFirst", |
|
1530 |
"shift HOME", "selectFirstExtendSelection", |
|
1531 |
"ctrl shift HOME", "selectFirstExtendSelection", |
|
1532 |
"ctrl HOME", "selectFirstChangeLead", |
|
1533 |
"END", "selectLast", |
|
1534 |
"shift END", "selectLastExtendSelection", |
|
1535 |
"ctrl shift END", "selectLastExtendSelection", |
|
1536 |
"ctrl END", "selectLastChangeLead", |
|
1537 |
"F2", "startEditing", |
|
1538 |
"ctrl A", "selectAll", |
|
1539 |
"ctrl SLASH", "selectAll", |
|
1540 |
"ctrl BACK_SLASH", "clearSelection", |
|
1541 |
"ctrl LEFT", "scrollLeft", |
|
1542 |
"ctrl KP_LEFT", "scrollLeft", |
|
1543 |
"ctrl RIGHT", "scrollRight", |
|
1544 |
"ctrl KP_RIGHT", "scrollRight", |
|
1545 |
"SPACE", "addToSelection", |
|
1546 |
"ctrl SPACE", "toggleAndAnchor", |
|
1547 |
"shift SPACE", "extendTo", |
|
1548 |
"ctrl shift SPACE", "moveSelectionTo" |
|
1549 |
}), |
|
1550 |
"Tree.ancestorInputMap", |
|
1551 |
new UIDefaults.LazyInputMap(new Object[] { |
|
1552 |
"ESCAPE", "cancel" |
|
1553 |
}), |
|
1554 |
||
1555 |
// *** Viewport |
|
1556 |
"Viewport.font", ControlFont, |
|
1557 |
"Viewport.background", ControlBackgroundColor, |
|
1558 |
"Viewport.foreground", WindowTextColor, |
|
1559 |
||
1560 |
||
1561 |
}; |
|
1562 |
||
1563 |
table.putDefaults(defaults); |
|
1564 |
table.putDefaults(getLazyValueDefaults()); |
|
1565 |
initVistaComponentDefaults(table); |
|
1566 |
} |
|
1567 |
||
1568 |
static boolean isOnVista() { |
|
1569 |
return OSInfo.getOSType() == OSInfo.OSType.WINDOWS |
|
1570 |
&& OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_VISTA) >= 0; |
|
1571 |
} |
|
1572 |
||
1573 |
private void initVistaComponentDefaults(UIDefaults table) { |
|
1574 |
if (! isOnVista()) { |
|
1575 |
return; |
|
1576 |
} |
|
1577 |
/* START handling menus for Vista */ |
|
1578 |
String[] menuClasses = { "MenuItem", "Menu", |
|
1579 |
"CheckBoxMenuItem", "RadioButtonMenuItem", |
|
1580 |
}; |
|
1581 |
||
1582 |
Object menuDefaults[] = new Object[menuClasses.length * 2]; |
|
1583 |
||
1584 |
/* all the menus need to be non opaque. */ |
|
1585 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1586 |
String key = menuClasses[i] + ".opaque"; |
|
1587 |
Object oldValue = table.get(key); |
|
1588 |
menuDefaults[j++] = key; |
|
1589 |
menuDefaults[j++] = |
|
1590 |
new XPValue(Boolean.FALSE, oldValue); |
|
1591 |
} |
|
1592 |
table.putDefaults(menuDefaults); |
|
1593 |
||
1594 |
/* |
|
1595 |
* acceleratorSelectionForeground color is the same as |
|
1596 |
* acceleratorForeground |
|
1597 |
*/ |
|
1598 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1599 |
String key = menuClasses[i] + ".acceleratorSelectionForeground"; |
|
1600 |
Object oldValue = table.get(key); |
|
1601 |
menuDefaults[j++] = key; |
|
1602 |
menuDefaults[j++] = |
|
1603 |
new XPValue( |
|
1604 |
table.getColor( |
|
1605 |
menuClasses[i] + ".acceleratorForeground"), |
|
1606 |
oldValue); |
|
1607 |
} |
|
1608 |
table.putDefaults(menuDefaults); |
|
1609 |
||
1610 |
/* they have the same MenuItemCheckIconFactory */ |
|
1611 |
VistaMenuItemCheckIconFactory menuItemCheckIconFactory = |
|
1612 |
WindowsIconFactory.getMenuItemCheckIconFactory(); |
|
1613 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1614 |
String key = menuClasses[i] + ".checkIconFactory"; |
|
1615 |
Object oldValue = table.get(key); |
|
1616 |
menuDefaults[j++] = key; |
|
1617 |
menuDefaults[j++] = |
|
1618 |
new XPValue(menuItemCheckIconFactory, oldValue); |
|
1619 |
} |
|
1620 |
table.putDefaults(menuDefaults); |
|
1621 |
||
1622 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1623 |
String key = menuClasses[i] + ".checkIcon"; |
|
1624 |
Object oldValue = table.get(key); |
|
1625 |
menuDefaults[j++] = key; |
|
1626 |
menuDefaults[j++] = |
|
1627 |
new XPValue(menuItemCheckIconFactory.getIcon(menuClasses[i]), |
|
1628 |
oldValue); |
|
1629 |
} |
|
1630 |
table.putDefaults(menuDefaults); |
|
1631 |
||
1632 |
||
1633 |
/* height can be even */ |
|
1634 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1635 |
String key = menuClasses[i] + ".evenHeight"; |
|
1636 |
Object oldValue = table.get(key); |
|
1637 |
menuDefaults[j++] = key; |
|
1638 |
menuDefaults[j++] = new XPValue(Boolean.TRUE, oldValue); |
|
1639 |
} |
|
1640 |
table.putDefaults(menuDefaults); |
|
1641 |
||
1642 |
/* no margins */ |
|
1643 |
InsetsUIResource insets = new InsetsUIResource(0, 0, 0, 0); |
|
1644 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1645 |
String key = menuClasses[i] + ".margin"; |
|
1646 |
Object oldValue = table.get(key); |
|
1647 |
menuDefaults[j++] = key; |
|
1648 |
menuDefaults[j++] = new XPValue(insets, oldValue); |
|
1649 |
} |
|
1650 |
table.putDefaults(menuDefaults); |
|
1651 |
||
1652 |
/* set checkIcon offset */ |
|
1653 |
Integer checkIconOffsetInteger = |
|
1654 |
Integer.valueOf(0); |
|
1655 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1656 |
String key = menuClasses[i] + ".checkIconOffset"; |
|
1657 |
Object oldValue = table.get(key); |
|
1658 |
menuDefaults[j++] = key; |
|
1659 |
menuDefaults[j++] = |
|
1660 |
new XPValue(checkIconOffsetInteger, oldValue); |
|
1661 |
} |
|
1662 |
table.putDefaults(menuDefaults); |
|
1663 |
||
1664 |
/* set width of the gap after check icon */ |
|
1665 |
Integer afterCheckIconGap = WindowsPopupMenuUI.getSpanBeforeGutter() |
|
1666 |
+ WindowsPopupMenuUI.getGutterWidth() |
|
1667 |
+ WindowsPopupMenuUI.getSpanAfterGutter(); |
|
1668 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1669 |
String key = menuClasses[i] + ".afterCheckIconGap"; |
|
1670 |
Object oldValue = table.get(key); |
|
1671 |
menuDefaults[j++] = key; |
|
1672 |
menuDefaults[j++] = |
|
1673 |
new XPValue(afterCheckIconGap, oldValue); |
|
1674 |
} |
|
1675 |
table.putDefaults(menuDefaults); |
|
1676 |
||
1677 |
/* text is started after this position */ |
|
1678 |
Object minimumTextOffset = new UIDefaults.ActiveValue() { |
|
1679 |
public Object createValue(UIDefaults table) { |
|
1680 |
return VistaMenuItemCheckIconFactory.getIconWidth() |
|
1681 |
+ WindowsPopupMenuUI.getSpanBeforeGutter() |
|
1682 |
+ WindowsPopupMenuUI.getGutterWidth() |
|
1683 |
+ WindowsPopupMenuUI.getSpanAfterGutter(); |
|
1684 |
} |
|
1685 |
}; |
|
1686 |
for (int i = 0, j = 0; i < menuClasses.length; i++) { |
|
1687 |
String key = menuClasses[i] + ".minimumTextOffset"; |
|
1688 |
Object oldValue = table.get(key); |
|
1689 |
menuDefaults[j++] = key; |
|
1690 |
menuDefaults[j++] = new XPValue(minimumTextOffset, oldValue); |
|
1691 |
} |
|
1692 |
table.putDefaults(menuDefaults); |
|
1693 |
||
1694 |
/* |
|
1695 |
* JPopupMenu has a bit of free space around menu items |
|
1696 |
*/ |
|
1697 |
String POPUP_MENU_BORDER = "PopupMenu.border"; |
|
1698 |
||
1699 |
Object popupMenuBorder = new XPBorderValue(Part.MENU, |
|
23612 | 1700 |
(LazyValue) t -> BasicBorders.getInternalFrameBorder(), |
2 | 1701 |
BorderFactory.createEmptyBorder(2, 2, 2, 2)); |
1702 |
table.put(POPUP_MENU_BORDER, popupMenuBorder); |
|
1703 |
/* END handling menus for Vista */ |
|
1704 |
||
1705 |
/* START table handling for Vista */ |
|
1706 |
table.put("Table.ascendingSortIcon", new XPValue( |
|
1707 |
new SkinIcon(Part.HP_HEADERSORTARROW, State.SORTEDDOWN), |
|
23612 | 1708 |
(LazyValue) t -> new ClassicSortArrowIcon(true))); |
2 | 1709 |
table.put("Table.descendingSortIcon", new XPValue( |
1710 |
new SkinIcon(Part.HP_HEADERSORTARROW, State.SORTEDUP), |
|
23612 | 1711 |
(LazyValue) t -> new ClassicSortArrowIcon(false))); |
2 | 1712 |
/* END table handling for Vista */ |
1713 |
} |
|
1714 |
||
1715 |
/** |
|
1716 |
* If we support loading of fonts from the desktop this will return |
|
1717 |
* a DesktopProperty representing the font. If the font can't be |
|
1718 |
* represented in the current encoding this will return null and |
|
1719 |
* turn off the use of system fonts. |
|
1720 |
*/ |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
1721 |
private Object getDesktopFontValue(String fontName, Object backup) { |
2 | 1722 |
if (useSystemFontSettings) { |
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
1723 |
return new WindowsFontProperty(fontName, backup); |
2 | 1724 |
} |
1725 |
return null; |
|
1726 |
} |
|
1727 |
||
1728 |
// When a desktop property change is detected, these classes must be |
|
1729 |
// reinitialized in the defaults table to ensure the classes reference |
|
1730 |
// the updated desktop property values (colors mostly) |
|
1731 |
// |
|
1732 |
private Object[] getLazyValueDefaults() { |
|
1733 |
||
1734 |
Object buttonBorder = |
|
1735 |
new XPBorderValue(Part.BP_PUSHBUTTON, |
|
23612 | 1736 |
(LazyValue) t -> BasicBorders.getButtonBorder()); |
2 | 1737 |
|
1738 |
Object textFieldBorder = |
|
1739 |
new XPBorderValue(Part.EP_EDIT, |
|
23612 | 1740 |
(LazyValue) t -> BasicBorders.getTextFieldBorder()); |
2 | 1741 |
|
1742 |
Object textFieldMargin = |
|
1743 |
new XPValue(new InsetsUIResource(2, 2, 2, 2), |
|
1744 |
new InsetsUIResource(1, 1, 1, 1)); |
|
1745 |
||
1746 |
Object spinnerBorder = |
|
1747 |
new XPBorderValue(Part.EP_EDIT, textFieldBorder, |
|
1748 |
new EmptyBorder(2, 2, 2, 2)); |
|
1749 |
||
1750 |
Object spinnerArrowInsets = |
|
1751 |
new XPValue(new InsetsUIResource(1, 1, 1, 1), |
|
1752 |
null); |
|
1753 |
||
1754 |
Object comboBoxBorder = new XPBorderValue(Part.CP_COMBOBOX, textFieldBorder); |
|
1755 |
||
1756 |
// For focus rectangle for cells and trees. |
|
23612 | 1757 |
LazyValue focusCellHighlightBorder = t -> WindowsBorders.getFocusCellHighlightBorder(); |
2 | 1758 |
|
23612 | 1759 |
LazyValue etchedBorder = t -> BorderUIResource.getEtchedBorderUIResource(); |
2 | 1760 |
|
23612 | 1761 |
LazyValue internalFrameBorder = t -> WindowsBorders.getInternalFrameBorder(); |
2 | 1762 |
|
23612 | 1763 |
LazyValue loweredBevelBorder = t -> BorderUIResource.getLoweredBevelBorderUIResource(); |
2 | 1764 |
|
1765 |
||
23612 | 1766 |
LazyValue marginBorder = t -> new BasicBorders.MarginBorder(); |
2 | 1767 |
|
23612 | 1768 |
LazyValue menuBarBorder = t -> BasicBorders.getMenuBarBorder(); |
2 | 1769 |
|
1770 |
||
1771 |
Object popupMenuBorder = new XPBorderValue(Part.MENU, |
|
23612 | 1772 |
(LazyValue) t -> BasicBorders.getInternalFrameBorder()); |
2 | 1773 |
|
1774 |
// *** ProgressBar |
|
23612 | 1775 |
LazyValue progressBarBorder = t -> WindowsBorders.getProgressBarBorder(); |
2 | 1776 |
|
23612 | 1777 |
LazyValue radioButtonBorder = t -> BasicBorders.getRadioButtonBorder(); |
2 | 1778 |
|
1779 |
Object scrollPaneBorder = |
|
1780 |
new XPBorderValue(Part.LBP_LISTBOX, textFieldBorder); |
|
1781 |
||
1782 |
Object tableScrollPaneBorder = |
|
1783 |
new XPBorderValue(Part.LBP_LISTBOX, loweredBevelBorder); |
|
1784 |
||
23612 | 1785 |
LazyValue tableHeaderBorder = t -> WindowsBorders.getTableHeaderBorder(); |
2 | 1786 |
|
1787 |
// *** ToolBar |
|
23612 | 1788 |
LazyValue toolBarBorder = t -> WindowsBorders.getToolBarBorder(); |
2 | 1789 |
|
1790 |
// *** ToolTips |
|
23612 | 1791 |
LazyValue toolTipBorder = t -> BorderUIResource.getBlackLineBorderUIResource(); |
2 | 1792 |
|
1793 |
||
1794 |
||
23612 | 1795 |
LazyValue checkBoxIcon = t -> WindowsIconFactory.getCheckBoxIcon(); |
2 | 1796 |
|
23612 | 1797 |
LazyValue radioButtonIcon = t -> WindowsIconFactory.getRadioButtonIcon(); |
2 | 1798 |
|
23612 | 1799 |
LazyValue radioButtonMenuItemIcon = t -> WindowsIconFactory.getRadioButtonMenuItemIcon(); |
2 | 1800 |
|
23612 | 1801 |
LazyValue menuItemCheckIcon = t -> WindowsIconFactory.getMenuItemCheckIcon(); |
2 | 1802 |
|
23612 | 1803 |
LazyValue menuItemArrowIcon = t -> WindowsIconFactory.getMenuItemArrowIcon(); |
2 | 1804 |
|
23612 | 1805 |
LazyValue menuArrowIcon = t -> WindowsIconFactory.getMenuArrowIcon(); |
2 | 1806 |
|
1807 |
||
1808 |
Object[] lazyDefaults = { |
|
1809 |
"Button.border", buttonBorder, |
|
1810 |
"CheckBox.border", radioButtonBorder, |
|
1811 |
"ComboBox.border", comboBoxBorder, |
|
1812 |
"DesktopIcon.border", internalFrameBorder, |
|
1813 |
"FormattedTextField.border", textFieldBorder, |
|
1814 |
"FormattedTextField.margin", textFieldMargin, |
|
1815 |
"InternalFrame.border", internalFrameBorder, |
|
1816 |
"List.focusCellHighlightBorder", focusCellHighlightBorder, |
|
1817 |
"Table.focusCellHighlightBorder", focusCellHighlightBorder, |
|
1818 |
"Menu.border", marginBorder, |
|
1819 |
"MenuBar.border", menuBarBorder, |
|
1820 |
"MenuItem.border", marginBorder, |
|
1821 |
"PasswordField.border", textFieldBorder, |
|
1822 |
"PasswordField.margin", textFieldMargin, |
|
1823 |
"PopupMenu.border", popupMenuBorder, |
|
1824 |
"ProgressBar.border", progressBarBorder, |
|
1825 |
"RadioButton.border", radioButtonBorder, |
|
1826 |
"ScrollPane.border", scrollPaneBorder, |
|
1827 |
"Spinner.border", spinnerBorder, |
|
1828 |
"Spinner.arrowButtonInsets", spinnerArrowInsets, |
|
1829 |
"Spinner.arrowButtonSize", new Dimension(17, 9), |
|
1830 |
"Table.scrollPaneBorder", tableScrollPaneBorder, |
|
1831 |
"TableHeader.cellBorder", tableHeaderBorder, |
|
1832 |
"TextArea.margin", textFieldMargin, |
|
1833 |
"TextField.border", textFieldBorder, |
|
1834 |
"TextField.margin", textFieldMargin, |
|
1835 |
"TitledBorder.border", |
|
1836 |
new XPBorderValue(Part.BP_GROUPBOX, etchedBorder), |
|
1837 |
"ToggleButton.border", radioButtonBorder, |
|
1838 |
"ToolBar.border", toolBarBorder, |
|
1839 |
"ToolTip.border", toolTipBorder, |
|
1840 |
||
1841 |
"CheckBox.icon", checkBoxIcon, |
|
1842 |
"Menu.arrowIcon", menuArrowIcon, |
|
1843 |
"MenuItem.checkIcon", menuItemCheckIcon, |
|
1844 |
"MenuItem.arrowIcon", menuItemArrowIcon, |
|
1845 |
"RadioButton.icon", radioButtonIcon, |
|
1846 |
"RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon, |
|
1847 |
"InternalFrame.layoutTitlePaneAtOrigin", |
|
1848 |
new XPValue(Boolean.TRUE, Boolean.FALSE), |
|
1849 |
"Table.ascendingSortIcon", new XPValue( |
|
23612 | 1850 |
(LazyValue) t -> new SortArrowIcon(true,"Table.sortIconColor"), |
1851 |
(LazyValue) t -> new ClassicSortArrowIcon(true)), |
|
2 | 1852 |
"Table.descendingSortIcon", new XPValue( |
23612 | 1853 |
(LazyValue) t -> new SortArrowIcon(false,"Table.sortIconColor"), |
1854 |
(LazyValue) t -> new ClassicSortArrowIcon(false)), |
|
2 | 1855 |
}; |
1856 |
||
1857 |
return lazyDefaults; |
|
1858 |
} |
|
1859 |
||
1860 |
public void uninitialize() { |
|
1861 |
super.uninitialize(); |
|
1862 |
||
1863 |
if (WindowsPopupMenuUI.mnemonicListener != null) { |
|
1864 |
MenuSelectionManager.defaultManager(). |
|
1865 |
removeChangeListener(WindowsPopupMenuUI.mnemonicListener); |
|
1866 |
} |
|
1867 |
KeyboardFocusManager.getCurrentKeyboardFocusManager(). |
|
1868 |
removeKeyEventPostProcessor(WindowsRootPaneUI.altProcessor); |
|
1869 |
DesktopProperty.flushUnreferencedProperties(); |
|
1870 |
} |
|
1871 |
||
1872 |
||
1873 |
// Toggle flag for drawing the mnemonic state |
|
1874 |
private static boolean isMnemonicHidden = true; |
|
1875 |
||
1876 |
// Flag which indicates that the Win98/Win2k/WinME features |
|
1877 |
// should be disabled. |
|
1878 |
private static boolean isClassicWindows = false; |
|
1879 |
||
1880 |
/** |
|
1881 |
* Sets the state of the hide mnemonic flag. This flag is used by the |
|
1882 |
* component UI delegates to determine if the mnemonic should be rendered. |
|
1883 |
* This method is a non operation if the underlying operating system |
|
1884 |
* does not support the mnemonic hiding feature. |
|
1885 |
* |
|
1886 |
* @param hide true if mnemonics should be hidden |
|
1887 |
* @since 1.4 |
|
1888 |
*/ |
|
1889 |
public static void setMnemonicHidden(boolean hide) { |
|
1890 |
if (UIManager.getBoolean("Button.showMnemonics") == true) { |
|
1891 |
// Do not hide mnemonics if the UI defaults do not support this |
|
1892 |
isMnemonicHidden = false; |
|
1893 |
} else { |
|
1894 |
isMnemonicHidden = hide; |
|
1895 |
} |
|
1896 |
} |
|
1897 |
||
1898 |
/** |
|
1899 |
* Gets the state of the hide mnemonic flag. This only has meaning |
|
1900 |
* if this feature is supported by the underlying OS. |
|
1901 |
* |
|
1902 |
* @return true if mnemonics are hidden, otherwise, false |
|
1903 |
* @see #setMnemonicHidden |
|
1904 |
* @since 1.4 |
|
1905 |
*/ |
|
1906 |
public static boolean isMnemonicHidden() { |
|
1907 |
if (UIManager.getBoolean("Button.showMnemonics") == true) { |
|
1908 |
// Do not hide mnemonics if the UI defaults do not support this |
|
1909 |
isMnemonicHidden = false; |
|
1910 |
} |
|
1911 |
return isMnemonicHidden; |
|
1912 |
} |
|
1913 |
||
1914 |
/** |
|
1915 |
* Gets the state of the flag which indicates if the old Windows |
|
1916 |
* look and feel should be rendered. This flag is used by the |
|
1917 |
* component UI delegates as a hint to determine which style the component |
|
1918 |
* should be rendered. |
|
1919 |
* |
|
1920 |
* @return true if Windows 95 and Windows NT 4 look and feel should |
|
1921 |
* be rendered |
|
1922 |
* @since 1.4 |
|
1923 |
*/ |
|
1924 |
public static boolean isClassicWindows() { |
|
1925 |
return isClassicWindows; |
|
1926 |
} |
|
1927 |
||
1928 |
/** |
|
1929 |
* <p> |
|
1930 |
* Invoked when the user attempts an invalid operation, |
|
1931 |
* such as pasting into an uneditable <code>JTextField</code> |
|
1932 |
* that has focus. |
|
1933 |
* </p> |
|
1934 |
* <p> |
|
1935 |
* If the user has enabled visual error indication on |
|
1936 |
* the desktop, this method will flash the caption bar |
|
1937 |
* of the active window. The user can also set the |
|
1938 |
* property awt.visualbell=true to achieve the same |
|
1939 |
* results. |
|
1940 |
* </p> |
|
1941 |
* |
|
21278 | 1942 |
* @param component Component the error occurred in, may be |
2 | 1943 |
* null indicating the error condition is |
1944 |
* not directly associated with a |
|
1945 |
* <code>Component</code>. |
|
1946 |
* |
|
1947 |
* @see javax.swing.LookAndFeel#provideErrorFeedback |
|
1948 |
*/ |
|
1949 |
public void provideErrorFeedback(Component component) { |
|
1950 |
super.provideErrorFeedback(component); |
|
1951 |
} |
|
1952 |
||
1953 |
/** |
|
1954 |
* {@inheritDoc} |
|
1955 |
*/ |
|
1956 |
public LayoutStyle getLayoutStyle() { |
|
1957 |
LayoutStyle style = this.style; |
|
1958 |
if (style == null) { |
|
1959 |
style = new WindowsLayoutStyle(); |
|
1960 |
this.style = style; |
|
1961 |
} |
|
1962 |
return style; |
|
1963 |
} |
|
1964 |
||
1965 |
// ********* Auditory Cue support methods and objects ********* |
|
1966 |
||
1967 |
/** |
|
1968 |
* Returns an <code>Action</code>. |
|
1969 |
* <P> |
|
1970 |
* This Action contains the information and logic to render an |
|
1971 |
* auditory cue. The <code>Object</code> that is passed to this |
|
1972 |
* method contains the information needed to render the auditory |
|
1973 |
* cue. Normally, this <code>Object</code> is a <code>String</code> |
|
1974 |
* that points to a <code>Toolkit</code> <code>desktopProperty</code>. |
|
1975 |
* This <code>desktopProperty</code> is resolved by AWT and the |
|
1976 |
* Windows OS. |
|
1977 |
* <P> |
|
1978 |
* This <code>Action</code>'s <code>actionPerformed</code> method |
|
1979 |
* is fired by the <code>playSound</code> method. |
|
1980 |
* |
|
1981 |
* @return an Action which knows how to render the auditory |
|
1982 |
* cue for one particular system or user activity |
|
1983 |
* @see #playSound(Action) |
|
1984 |
* @since 1.4 |
|
1985 |
*/ |
|
1986 |
protected Action createAudioAction(Object key) { |
|
1987 |
if (key != null) { |
|
1988 |
String audioKey = (String)key; |
|
1989 |
String audioValue = (String)UIManager.get(key); |
|
1990 |
return new AudioAction(audioKey, audioValue); |
|
1991 |
} else { |
|
1992 |
return null; |
|
1993 |
} |
|
1994 |
} |
|
1995 |
||
1996 |
static void repaintRootPane(Component c) { |
|
1997 |
JRootPane root = null; |
|
1998 |
for (; c != null; c = c.getParent()) { |
|
1999 |
if (c instanceof JRootPane) { |
|
2000 |
root = (JRootPane)c; |
|
2001 |
} |
|
2002 |
} |
|
2003 |
||
2004 |
if (root != null) { |
|
2005 |
root.repaint(); |
|
2006 |
} else { |
|
2007 |
c.repaint(); |
|
2008 |
} |
|
2009 |
} |
|
2010 |
||
2011 |
/** |
|
2012 |
* Pass the name String to the super constructor. This is used |
|
2013 |
* later to identify the Action and decide whether to play it or |
|
2014 |
* not. Store the resource String. It is used to get the audio |
|
2015 |
* resource. In this case, the resource is a <code>Runnable</code> |
|
2016 |
* supplied by <code>Toolkit</code>. This <code>Runnable</code> is |
|
2017 |
* effectively a pointer down into the Win32 OS that knows how to |
|
2018 |
* play the right sound. |
|
2019 |
* |
|
2020 |
* @since 1.4 |
|
2021 |
*/ |
|
23632
cd7a34d12e8c
8033908: Fix serial lint warnings in com.sun.java.swing.plaf
darcy
parents:
23612
diff
changeset
|
2022 |
@SuppressWarnings("serial") // Superclass is not serializable across versions |
2 | 2023 |
private static class AudioAction extends AbstractAction { |
2024 |
private Runnable audioRunnable; |
|
2025 |
private String audioResource; |
|
2026 |
/** |
|
2027 |
* We use the String as the name of the Action and as a pointer to |
|
2028 |
* the underlying OSes audio resource. |
|
2029 |
*/ |
|
2030 |
public AudioAction(String name, String resource) { |
|
2031 |
super(name); |
|
2032 |
audioResource = resource; |
|
2033 |
} |
|
2034 |
public void actionPerformed(ActionEvent e) { |
|
2035 |
if (audioRunnable == null) { |
|
2036 |
audioRunnable = (Runnable)Toolkit.getDefaultToolkit().getDesktopProperty(audioResource); |
|
2037 |
} |
|
2038 |
if (audioRunnable != null) { |
|
2039 |
// Runnable appears to block until completed playing, hence |
|
2040 |
// start up another thread to handle playing. |
|
31653
d88ff422c7fb
8080405: Exception in thread "AWT-EventQueue-1" java.security.AccessControlException
serb
parents:
29922
diff
changeset
|
2041 |
new ManagedLocalsThread(audioRunnable).start(); |
2 | 2042 |
} |
2043 |
} |
|
2044 |
} |
|
2045 |
||
2046 |
/** |
|
2047 |
* Gets an <code>Icon</code> from the native libraries if available, |
|
2048 |
* otherwise gets it from an image resource file. |
|
2049 |
*/ |
|
2050 |
private static class LazyWindowsIcon implements UIDefaults.LazyValue { |
|
2051 |
private String nativeImage; |
|
2052 |
private String resource; |
|
2053 |
||
2054 |
LazyWindowsIcon(String nativeImage, String resource) { |
|
2055 |
this.nativeImage = nativeImage; |
|
2056 |
this.resource = resource; |
|
2057 |
} |
|
2058 |
||
2059 |
public Object createValue(UIDefaults table) { |
|
2060 |
if (nativeImage != null) { |
|
2061 |
Image image = (Image)ShellFolder.get(nativeImage); |
|
2062 |
if (image != null) { |
|
2063 |
return new ImageIcon(image); |
|
2064 |
} |
|
2065 |
} |
|
2066 |
return SwingUtilities2.makeIcon(getClass(), |
|
2067 |
WindowsLookAndFeel.class, |
|
2068 |
resource); |
|
2069 |
} |
|
2070 |
} |
|
2071 |
||
2072 |
||
2073 |
/** |
|
2074 |
* Gets an <code>Icon</code> from the native libraries if available. |
|
2075 |
* A desktop property is used to trigger reloading the icon when needed. |
|
2076 |
*/ |
|
2077 |
private class ActiveWindowsIcon implements UIDefaults.ActiveValue { |
|
2078 |
private Icon icon; |
|
2079 |
private String nativeImageName; |
|
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2080 |
private String fallbackName; |
2 | 2081 |
private DesktopProperty desktopProperty; |
2082 |
||
2083 |
ActiveWindowsIcon(String desktopPropertyName, |
|
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2084 |
String nativeImageName, String fallbackName) { |
2 | 2085 |
this.nativeImageName = nativeImageName; |
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2086 |
this.fallbackName = fallbackName; |
2 | 2087 |
|
2088 |
if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS && |
|
2089 |
OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) < 0) { |
|
2090 |
// This desktop property is needed to trigger reloading the icon. |
|
2091 |
// It is kept in member variable to avoid GC. |
|
2092 |
this.desktopProperty = new TriggerDesktopProperty(desktopPropertyName) { |
|
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2093 |
@Override protected void updateUI() { |
2 | 2094 |
icon = null; |
2095 |
super.updateUI(); |
|
2096 |
} |
|
2097 |
}; |
|
2098 |
} |
|
2099 |
} |
|
2100 |
||
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2101 |
@Override |
2 | 2102 |
public Object createValue(UIDefaults table) { |
2103 |
if (icon == null) { |
|
2104 |
Image image = (Image)ShellFolder.get(nativeImageName); |
|
2105 |
if (image != null) { |
|
2106 |
icon = new ImageIconUIResource(image); |
|
2107 |
} |
|
2108 |
} |
|
1847
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2109 |
if (icon == null && fallbackName != null) { |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2110 |
UIDefaults.LazyValue fallback = (UIDefaults.LazyValue) |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2111 |
SwingUtilities2.makeIcon(WindowsLookAndFeel.class, |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2112 |
BasicLookAndFeel.class, fallbackName); |
ead8e9499c20
6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents:
715
diff
changeset
|
2113 |
icon = (Icon) fallback.createValue(table); |
2 | 2114 |
} |
2115 |
return icon; |
|
2116 |
} |
|
2117 |
} |
|
2118 |
||
2119 |
/** |
|
2120 |
* Icon backed-up by XP Skin. |
|
2121 |
*/ |
|
2122 |
private static class SkinIcon implements Icon, UIResource { |
|
2123 |
private final Part part; |
|
2124 |
private final State state; |
|
2125 |
SkinIcon(Part part, State state) { |
|
2126 |
this.part = part; |
|
2127 |
this.state = state; |
|
2128 |
} |
|
2129 |
||
2130 |
/** |
|
2131 |
* Draw the icon at the specified location. Icon implementations |
|
2132 |
* may use the Component argument to get properties useful for |
|
2133 |
* painting, e.g. the foreground or background color. |
|
2134 |
*/ |
|
2135 |
public void paintIcon(Component c, Graphics g, int x, int y) { |
|
2136 |
XPStyle xp = XPStyle.getXP(); |
|
2137 |
assert xp != null; |
|
2138 |
if (xp != null) { |
|
2139 |
Skin skin = xp.getSkin(null, part); |
|
2140 |
skin.paintSkin(g, x, y, state); |
|
2141 |
} |
|
2142 |
} |
|
2143 |
||
2144 |
/** |
|
2145 |
* Returns the icon's width. |
|
2146 |
* |
|
2147 |
* @return an int specifying the fixed width of the icon. |
|
2148 |
*/ |
|
2149 |
public int getIconWidth() { |
|
2150 |
int width = 0; |
|
2151 |
XPStyle xp = XPStyle.getXP(); |
|
2152 |
assert xp != null; |
|
2153 |
if (xp != null) { |
|
2154 |
Skin skin = xp.getSkin(null, part); |
|
2155 |
width = skin.getWidth(); |
|
2156 |
} |
|
2157 |
return width; |
|
2158 |
} |
|
2159 |
||
2160 |
/** |
|
2161 |
* Returns the icon's height. |
|
2162 |
* |
|
2163 |
* @return an int specifying the fixed height of the icon. |
|
2164 |
*/ |
|
2165 |
public int getIconHeight() { |
|
2166 |
int height = 0; |
|
2167 |
XPStyle xp = XPStyle.getXP(); |
|
2168 |
if (xp != null) { |
|
2169 |
Skin skin = xp.getSkin(null, part); |
|
2170 |
height = skin.getHeight(); |
|
2171 |
} |
|
2172 |
return height; |
|
2173 |
} |
|
2174 |
||
2175 |
} |
|
2176 |
||
2177 |
/** |
|
2178 |
* DesktopProperty for fonts. If a font with the name 'MS Sans Serif' |
|
2179 |
* is returned, it is mapped to 'Microsoft Sans Serif'. |
|
2180 |
*/ |
|
2181 |
private static class WindowsFontProperty extends DesktopProperty { |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
2182 |
WindowsFontProperty(String key, Object backup) { |
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
2183 |
super(key, backup); |
2 | 2184 |
} |
2185 |
||
2186 |
public void invalidate(LookAndFeel laf) { |
|
2187 |
if ("win.defaultGUI.font.height".equals(getKey())) { |
|
2188 |
((WindowsLookAndFeel)laf).style = null; |
|
2189 |
} |
|
2190 |
super.invalidate(laf); |
|
2191 |
} |
|
2192 |
||
2193 |
protected Object configureValue(Object value) { |
|
2194 |
if (value instanceof Font) { |
|
2195 |
Font font = (Font)value; |
|
2196 |
if ("MS Sans Serif".equals(font.getName())) { |
|
2197 |
int size = font.getSize(); |
|
2198 |
// 4950968: Workaround to mimic the way Windows maps the default |
|
2199 |
// font size of 6 pts to the smallest available bitmap font size. |
|
2200 |
// This happens mostly on Win 98/Me & NT. |
|
2201 |
int dpi; |
|
2202 |
try { |
|
2203 |
dpi = Toolkit.getDefaultToolkit().getScreenResolution(); |
|
2204 |
} catch (HeadlessException ex) { |
|
2205 |
dpi = 96; |
|
2206 |
} |
|
2207 |
if (Math.round(size * 72F / dpi) < 8) { |
|
2208 |
size = Math.round(8 * dpi / 72F); |
|
2209 |
} |
|
2210 |
Font msFont = new FontUIResource("Microsoft Sans Serif", |
|
2211 |
font.getStyle(), size); |
|
2212 |
if (msFont.getName() != null && |
|
2213 |
msFont.getName().equals(msFont.getFamily())) { |
|
2214 |
font = msFont; |
|
2215 |
} else if (size != font.getSize()) { |
|
2216 |
font = new FontUIResource("MS Sans Serif", |
|
2217 |
font.getStyle(), size); |
|
2218 |
} |
|
2219 |
} |
|
3928 | 2220 |
|
2221 |
if (FontUtilities.fontSupportsDefaultEncoding(font)) { |
|
2 | 2222 |
if (!(font instanceof UIResource)) { |
2223 |
font = new FontUIResource(font); |
|
2224 |
} |
|
2225 |
} |
|
2226 |
else { |
|
3928 | 2227 |
font = FontUtilities.getCompositeFontUIResource(font); |
2 | 2228 |
} |
2229 |
return font; |
|
2230 |
||
2231 |
} |
|
2232 |
return super.configureValue(value); |
|
2233 |
} |
|
2234 |
} |
|
2235 |
||
2236 |
||
2237 |
/** |
|
2238 |
* DesktopProperty for fonts that only gets sizes from the desktop, |
|
2239 |
* font name and style are passed into the constructor |
|
2240 |
*/ |
|
2241 |
private static class WindowsFontSizeProperty extends DesktopProperty { |
|
2242 |
private String fontName; |
|
2243 |
private int fontSize; |
|
2244 |
private int fontStyle; |
|
2245 |
||
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
2246 |
WindowsFontSizeProperty(String key, String fontName, |
2 | 2247 |
int fontStyle, int fontSize) { |
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
2248 |
super(key, null); |
2 | 2249 |
this.fontName = fontName; |
2250 |
this.fontSize = fontSize; |
|
2251 |
this.fontStyle = fontStyle; |
|
2252 |
} |
|
2253 |
||
2254 |
protected Object configureValue(Object value) { |
|
2255 |
if (value == null) { |
|
2256 |
value = new FontUIResource(fontName, fontStyle, fontSize); |
|
2257 |
} |
|
2258 |
else if (value instanceof Integer) { |
|
2259 |
value = new FontUIResource(fontName, fontStyle, |
|
2260 |
((Integer)value).intValue()); |
|
2261 |
} |
|
2262 |
return value; |
|
2263 |
} |
|
2264 |
} |
|
2265 |
||
2266 |
||
2267 |
/** |
|
2268 |
* A value wrapper that actively retrieves values from xp or falls back |
|
2269 |
* to the classic value if not running XP styles. |
|
2270 |
*/ |
|
2271 |
private static class XPValue implements UIDefaults.ActiveValue { |
|
2272 |
protected Object classicValue, xpValue; |
|
2273 |
||
2274 |
// A constant that lets you specify null when using XP styles. |
|
2275 |
private final static Object NULL_VALUE = new Object(); |
|
2276 |
||
2277 |
XPValue(Object xpValue, Object classicValue) { |
|
2278 |
this.xpValue = xpValue; |
|
2279 |
this.classicValue = classicValue; |
|
2280 |
} |
|
2281 |
||
2282 |
public Object createValue(UIDefaults table) { |
|
2283 |
Object value = null; |
|
2284 |
if (XPStyle.getXP() != null) { |
|
2285 |
value = getXPValue(table); |
|
2286 |
} |
|
2287 |
||
2288 |
if (value == null) { |
|
2289 |
value = getClassicValue(table); |
|
2290 |
} else if (value == NULL_VALUE) { |
|
2291 |
value = null; |
|
2292 |
} |
|
2293 |
||
2294 |
return value; |
|
2295 |
} |
|
2296 |
||
2297 |
protected Object getXPValue(UIDefaults table) { |
|
2298 |
return recursiveCreateValue(xpValue, table); |
|
2299 |
} |
|
2300 |
||
2301 |
protected Object getClassicValue(UIDefaults table) { |
|
2302 |
return recursiveCreateValue(classicValue, table); |
|
2303 |
} |
|
2304 |
||
2305 |
private Object recursiveCreateValue(Object value, UIDefaults table) { |
|
2306 |
if (value instanceof UIDefaults.LazyValue) { |
|
2307 |
value = ((UIDefaults.LazyValue)value).createValue(table); |
|
2308 |
} |
|
2309 |
if (value instanceof UIDefaults.ActiveValue) { |
|
2310 |
return ((UIDefaults.ActiveValue)value).createValue(table); |
|
2311 |
} else { |
|
2312 |
return value; |
|
2313 |
} |
|
2314 |
} |
|
2315 |
} |
|
2316 |
||
2317 |
private static class XPBorderValue extends XPValue { |
|
2318 |
private final Border extraMargin; |
|
2319 |
||
2320 |
XPBorderValue(Part xpValue, Object classicValue) { |
|
2321 |
this(xpValue, classicValue, null); |
|
2322 |
} |
|
2323 |
||
2324 |
XPBorderValue(Part xpValue, Object classicValue, Border extraMargin) { |
|
2325 |
super(xpValue, classicValue); |
|
2326 |
this.extraMargin = extraMargin; |
|
2327 |
} |
|
2328 |
||
2329 |
public Object getXPValue(UIDefaults table) { |
|
25574 | 2330 |
XPStyle xp = XPStyle.getXP(); |
2331 |
Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null; |
|
2332 |
if (xpBorder != null && extraMargin != null) { |
|
2 | 2333 |
return new BorderUIResource. |
2334 |
CompoundBorderUIResource(xpBorder, extraMargin); |
|
2335 |
} else { |
|
2336 |
return xpBorder; |
|
2337 |
} |
|
2338 |
} |
|
2339 |
} |
|
2340 |
||
2341 |
private static class XPColorValue extends XPValue { |
|
2342 |
XPColorValue(Part part, State state, Prop prop, Object classicValue) { |
|
2343 |
super(new XPColorValueKey(part, state, prop), classicValue); |
|
2344 |
} |
|
2345 |
||
2346 |
public Object getXPValue(UIDefaults table) { |
|
2347 |
XPColorValueKey key = (XPColorValueKey)xpValue; |
|
25574 | 2348 |
XPStyle xp = XPStyle.getXP(); |
2349 |
return xp != null ? xp.getColor(key.skin, key.prop, null) : null; |
|
2 | 2350 |
} |
2351 |
||
2352 |
private static class XPColorValueKey { |
|
2353 |
Skin skin; |
|
2354 |
Prop prop; |
|
2355 |
||
2356 |
XPColorValueKey(Part part, State state, Prop prop) { |
|
2357 |
this.skin = new Skin(part, state); |
|
2358 |
this.prop = prop; |
|
2359 |
} |
|
2360 |
} |
|
2361 |
} |
|
2362 |
||
2363 |
private class XPDLUValue extends XPValue { |
|
2364 |
private int direction; |
|
2365 |
||
2366 |
XPDLUValue(int xpdlu, int classicdlu, int direction) { |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
2367 |
super(Integer.valueOf(xpdlu), Integer.valueOf(classicdlu)); |
2 | 2368 |
this.direction = direction; |
2369 |
} |
|
2370 |
||
2371 |
public Object getXPValue(UIDefaults table) { |
|
2372 |
int px = dluToPixels(((Integer)xpValue).intValue(), direction); |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
2373 |
return Integer.valueOf(px); |
2 | 2374 |
} |
2375 |
||
2376 |
public Object getClassicValue(UIDefaults table) { |
|
2377 |
int px = dluToPixels(((Integer)classicValue).intValue(), direction); |
|
438
2ae294e4518c
6613529: Avoid duplicate object creation within JDK packages
dav
parents:
2
diff
changeset
|
2378 |
return Integer.valueOf(px); |
2 | 2379 |
} |
2380 |
} |
|
2381 |
||
2382 |
private class TriggerDesktopProperty extends DesktopProperty { |
|
2383 |
TriggerDesktopProperty(String key) { |
|
3732
a4009b9b2f65
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents:
2658
diff
changeset
|
2384 |
super(key, null); |
2 | 2385 |
// This call adds a property change listener for the property, |
2386 |
// which triggers a call to updateUI(). The value returned |
|
2387 |
// is not interesting here. |
|
2388 |
getValueFromDesktop(); |
|
2389 |
} |
|
2390 |
||
2391 |
protected void updateUI() { |
|
2392 |
super.updateUI(); |
|
2393 |
||
2394 |
// Make sure property change listener is readded each time |
|
2395 |
getValueFromDesktop(); |
|
2396 |
} |
|
2397 |
} |
|
2398 |
||
2399 |
private class FontDesktopProperty extends TriggerDesktopProperty { |
|
2400 |
FontDesktopProperty(String key) { |
|
2401 |
super(key); |
|
2402 |
} |
|
2403 |
||
2404 |
protected void updateUI() { |
|
2405 |
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true); |
|
2406 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
|
2407 |
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo); |
|
2408 |
super.updateUI(); |
|
2409 |
} |
|
2410 |
} |
|
2411 |
||
2412 |
// Windows LayoutStyle. From: |
|
2413 |
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp |
|
24528 | 2414 |
@SuppressWarnings("fallthrough") |
2 | 2415 |
private class WindowsLayoutStyle extends DefaultLayoutStyle { |
2416 |
@Override |
|
2417 |
public int getPreferredGap(JComponent component1, |
|
2418 |
JComponent component2, ComponentPlacement type, int position, |
|
2419 |
Container parent) { |
|
2420 |
// Checks args |
|
2421 |
super.getPreferredGap(component1, component2, type, position, |
|
2422 |
parent); |
|
2423 |
||
2424 |
switch(type) { |
|
2425 |
case INDENT: |
|
2426 |
// Windows doesn't spec this |
|
2427 |
if (position == SwingConstants.EAST || |
|
2428 |
position == SwingConstants.WEST) { |
|
2429 |
int indent = getIndent(component1, position); |
|
2430 |
if (indent > 0) { |
|
2431 |
return indent; |
|
2432 |
} |
|
2433 |
return 10; |
|
2434 |
} |
|
2435 |
// Fall through to related. |
|
2436 |
case RELATED: |
|
2437 |
if (isLabelAndNonlabel(component1, component2, position)) { |
|
2438 |
// Between text labels and their associated controls (for |
|
2439 |
// example, text boxes and list boxes): 3 |
|
2440 |
// NOTE: We're not honoring: |
|
2441 |
// 'Text label beside a button 3 down from the top of |
|
2442 |
// the button,' but I suspect that is an attempt to |
|
2443 |
// enforce a baseline layout which will be handled |
|
2444 |
// separately. In order to enforce this we would need |
|
2445 |
// this API to return a more complicated type (Insets, |
|
2446 |
// or something else). |
|
2447 |
return getButtonGap(component1, component2, position, |
|
2448 |
dluToPixels(3, position)); |
|
2449 |
} |
|
2450 |
// Between related controls: 4 |
|
2451 |
return getButtonGap(component1, component2, position, |
|
2452 |
dluToPixels(4, position)); |
|
2453 |
case UNRELATED: |
|
2454 |
// Between unrelated controls: 7 |
|
2455 |
return getButtonGap(component1, component2, position, |
|
2456 |
dluToPixels(7, position)); |
|
2457 |
} |
|
2458 |
return 0; |
|
2459 |
} |
|
2460 |
||
2461 |
@Override |
|
2462 |
public int getContainerGap(JComponent component, int position, |
|
2463 |
Container parent) { |
|
2464 |
// Checks args |
|
2465 |
super.getContainerGap(component, position, parent); |
|
2466 |
return getButtonGap(component, position, dluToPixels(7, position)); |
|
2467 |
} |
|
2468 |
||
2469 |
} |
|
2470 |
||
2471 |
/** |
|
2472 |
* Converts the dialog unit argument to pixels along the specified |
|
2473 |
* axis. |
|
2474 |
*/ |
|
2475 |
private int dluToPixels(int dlu, int direction) { |
|
2476 |
if (baseUnitX == 0) { |
|
2477 |
calculateBaseUnits(); |
|
2478 |
} |
|
2479 |
if (direction == SwingConstants.EAST || |
|
2480 |
direction == SwingConstants.WEST) { |
|
2481 |
return dlu * baseUnitX / 4; |
|
2482 |
} |
|
2483 |
assert (direction == SwingConstants.NORTH || |
|
2484 |
direction == SwingConstants.SOUTH); |
|
2485 |
return dlu * baseUnitY / 8; |
|
2486 |
} |
|
2487 |
||
2488 |
/** |
|
2489 |
* Calculates the dialog unit mapping. |
|
2490 |
*/ |
|
28231
b608ffcaed74
8066621: Suppress deprecation warnings in java.desktop module
darcy
parents:
25859
diff
changeset
|
2491 |
@SuppressWarnings("deprecation") |
2 | 2492 |
private void calculateBaseUnits() { |
2493 |
// This calculation comes from: |
|
2494 |
// http://support.microsoft.com/default.aspx?scid=kb;EN-US;125681 |
|
2495 |
FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics( |
|
2496 |
UIManager.getFont("Button.font")); |
|
2497 |
baseUnitX = metrics.stringWidth( |
|
2498 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); |
|
2499 |
baseUnitX = (baseUnitX / 26 + 1) / 2; |
|
2500 |
// The -1 comes from experimentation. |
|
2501 |
baseUnitY = metrics.getAscent() + metrics.getDescent() - 1; |
|
2502 |
} |
|
2503 |
||
2504 |
/** |
|
2505 |
* {@inheritDoc} |
|
2506 |
* |
|
2507 |
* @since 1.6 |
|
2508 |
*/ |
|
2509 |
public Icon getDisabledIcon(JComponent component, Icon icon) { |
|
2510 |
// if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY |
|
2511 |
// client property set to Boolean.TRUE, then use the new |
|
2512 |
// hi res algorithm for creating the disabled icon (used |
|
2513 |
// in particular by the WindowsFileChooserUI class) |
|
2514 |
if (icon != null |
|
2515 |
&& component != null |
|
2516 |
&& Boolean.TRUE.equals(component.getClientProperty(HI_RES_DISABLED_ICON_CLIENT_KEY)) |
|
2517 |
&& icon.getIconWidth() > 0 |
|
2518 |
&& icon.getIconHeight() > 0) { |
|
2519 |
BufferedImage img = new BufferedImage(icon.getIconWidth(), |
|
2520 |
icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB); |
|
2521 |
icon.paintIcon(component, img.getGraphics(), 0, 0); |
|
2522 |
ImageFilter filter = new RGBGrayFilter(); |
|
2523 |
ImageProducer producer = new FilteredImageSource(img.getSource(), filter); |
|
2524 |
Image resultImage = component.createImage(producer); |
|
2525 |
return new ImageIconUIResource(resultImage); |
|
2526 |
} |
|
2527 |
return super.getDisabledIcon(component, icon); |
|
2528 |
} |
|
2529 |
||
2530 |
private static class RGBGrayFilter extends RGBImageFilter { |
|
2531 |
public RGBGrayFilter() { |
|
2532 |
canFilterIndexColorModel = true; |
|
2533 |
} |
|
2534 |
public int filterRGB(int x, int y, int rgb) { |
|
2535 |
// find the average of red, green, and blue |
|
2536 |
float avg = (((rgb >> 16) & 0xff) / 255f + |
|
2537 |
((rgb >> 8) & 0xff) / 255f + |
|
2538 |
(rgb & 0xff) / 255f) / 3; |
|
2539 |
// pull out the alpha channel |
|
2540 |
float alpha = (((rgb>>24)&0xff)/255f); |
|
2541 |
// calc the average |
|
2542 |
avg = Math.min(1.0f, (1f-avg)/(100.0f/35.0f) + avg); |
|
2543 |
// turn back into rgb |
|
2544 |
int rgbval = (int)(alpha * 255f) << 24 | |
|
2545 |
(int)(avg * 255f) << 16 | |
|
2546 |
(int)(avg * 255f) << 8 | |
|
2547 |
(int)(avg * 255f); |
|
2548 |
return rgbval; |
|
2549 |
} |
|
2550 |
} |
|
2551 |
||
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2552 |
private static class FocusColorProperty extends DesktopProperty { |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2553 |
public FocusColorProperty () { |
15315
9db01c15ae0c
7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents:
13779
diff
changeset
|
2554 |
// Fallback value is never used because of the configureValue method doesn't return null |
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2555 |
super("win.3d.backgroundColor", Color.BLACK); |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2556 |
} |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2557 |
|
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2558 |
@Override |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2559 |
protected Object configureValue(Object value) { |
15315
9db01c15ae0c
7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents:
13779
diff
changeset
|
2560 |
Object highContrastOn = Toolkit.getDefaultToolkit(). |
9db01c15ae0c
7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents:
13779
diff
changeset
|
2561 |
getDesktopProperty("win.highContrast.on"); |
9db01c15ae0c
7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents:
13779
diff
changeset
|
2562 |
if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) { |
11975
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2563 |
return Color.BLACK; |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2564 |
} |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2565 |
return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK; |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2566 |
} |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2567 |
} |
d3620e28371c
7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents:
10413
diff
changeset
|
2568 |
|
23632
cd7a34d12e8c
8033908: Fix serial lint warnings in com.sun.java.swing.plaf
darcy
parents:
23612
diff
changeset
|
2569 |
} |