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