1 7 8 22 23 package com.sun.java.swing.plaf.windows; 24 25 import java.awt.*; 26 import javax.swing.plaf.*; 27 import javax.swing.*; 28 import javax.swing.plaf.basic.*; 29 import javax.swing.border.*; 30 import javax.swing.text.JTextComponent ; 31 import javax.swing.text.DefaultEditorKit ; 32 33 import java.awt.Font ; 34 import java.awt.Color ; 35 import java.awt.SystemColor ; 36 import java.awt.event.KeyEvent ; 37 import java.awt.event.InputEvent ; 38 import java.awt.event.ActionEvent ; 39 40 import java.beans.PropertyChangeListener ; 41 import java.beans.PropertyChangeEvent ; 42 43 import java.net.URL ; 44 import java.io.Serializable ; 45 import java.security.AccessController ; 46 import java.util.*; 47 48 import sun.awt.shell.ShellFolder; 49 import sun.font.FontManager; 50 import sun.security.action.GetPropertyAction; 51 52 import sun.swing.SwingLazyValue; 53 import sun.swing.BorderProvider; 54 import com.sun.java.swing.SwingUtilities2; 55 56 import com.sun.java.swing.plaf.windows.TMSchema.*; 57 import com.sun.java.swing.plaf.windows.XPStyle.Skin; 58 59 import com.sun.java.swing.plaf.windows.WindowsIconFactory 60 .VistaMenuItemCheckIconFactory; 61 62 77 public class WindowsLookAndFeel extends BasicLookAndFeel 78 { 79 private Toolkit toolkit; 80 private boolean updatePending = false; 81 82 private boolean useSystemFontSettings = true; 83 private boolean useSystemFontSizeSettings; 84 85 private DesktopProperty themeActive, dllName, colorName, sizeName; 88 89 public String getName() { 90 return "Windows"; 91 } 92 93 public String getDescription() { 94 return "The Microsoft Windows Look and Feel"; 95 } 96 97 public String getID() { 98 return "Windows"; 99 } 100 101 public boolean isNativeLookAndFeel() { 102 String osName = System.getProperty("os.name"); 103 return (osName != null) && (osName.indexOf("Windows") != -1); 104 } 105 106 public boolean isSupportedLookAndFeel() { 107 return isNativeLookAndFeel(); 108 } 109 110 public void initialize() { 111 super.initialize(); 112 toolkit = Toolkit.getDefaultToolkit(); 113 114 String osVersion = System.getProperty("os.version"); 118 if (osVersion != null) { 119 Float version = Float.valueOf(osVersion); 120 if (version.floatValue() <= 4.0) { 121 isClassicWindows = true; 122 } else { 123 isClassicWindows = false; 124 XPStyle.invalidateStyle(); 125 } 126 } 127 128 String systemFonts = (String ) java.security.AccessController.doPrivileged( 133 new GetPropertyAction("swing.useSystemFontSettings")); 134 useSystemFontSettings = (systemFonts == null || 135 Boolean.valueOf(systemFonts).booleanValue()); 136 137 if (useSystemFontSettings) { 138 Object value = UIManager.get("Application.useSystemFontSettings"); 139 140 useSystemFontSettings = (value == null || 141 Boolean.TRUE.equals(value)); 142 } 143 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 144 addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor); 145 146 } 147 148 157 protected void initClassDefaults(UIDefaults table) 158 { 159 super.initClassDefaults(table); 160 161 final String windowsPackageName = "com.sun.java.swing.plaf.windows."; 162 163 Object [] uiDefaults = { 164 "ButtonUI", windowsPackageName + "WindowsButtonUI", 165 "CheckBoxUI", windowsPackageName + "WindowsCheckBoxUI", 166 "CheckBoxMenuItemUI", windowsPackageName + "WindowsCheckBoxMenuItemUI", 167 "LabelUI", windowsPackageName + "WindowsLabelUI", 168 "RadioButtonUI", windowsPackageName + "WindowsRadioButtonUI", 169 "RadioButtonMenuItemUI", windowsPackageName + "WindowsRadioButtonMenuItemUI", 170 "ToggleButtonUI", windowsPackageName + "WindowsToggleButtonUI", 171 "ProgressBarUI", windowsPackageName + "WindowsProgressBarUI", 172 "SliderUI", windowsPackageName + "WindowsSliderUI", 173 "SeparatorUI", windowsPackageName + "WindowsSeparatorUI", 174 "SplitPaneUI", windowsPackageName + "WindowsSplitPaneUI", 175 "SpinnerUI", windowsPackageName + "WindowsSpinnerUI", 176 "TabbedPaneUI", windowsPackageName + "WindowsTabbedPaneUI", 177 "TextAreaUI", windowsPackageName + "WindowsTextAreaUI", 178 "TextFieldUI", windowsPackageName + "WindowsTextFieldUI", 179 "PasswordFieldUI", windowsPackageName + "WindowsPasswordFieldUI", 180 "TextPaneUI", windowsPackageName + "WindowsTextPaneUI", 181 "EditorPaneUI", windowsPackageName + "WindowsEditorPaneUI", 182 "TreeUI", windowsPackageName + "WindowsTreeUI", 183 "ToolBarUI", windowsPackageName + "WindowsToolBarUI", 184 "ToolBarSeparatorUI", windowsPackageName + "WindowsToolBarSeparatorUI", 185 "ComboBoxUI", windowsPackageName + "WindowsComboBoxUI", 186 "TableHeaderUI", windowsPackageName + "WindowsTableHeaderUI", 187 "InternalFrameUI", windowsPackageName + "WindowsInternalFrameUI", 188 "DesktopPaneUI", windowsPackageName + "WindowsDesktopPaneUI", 189 "DesktopIconUI", windowsPackageName + "WindowsDesktopIconUI", 190 "FileChooserUI", windowsPackageName + "WindowsFileChooserUI", 191 "MenuUI", windowsPackageName + "WindowsMenuUI", 192 "MenuItemUI", windowsPackageName + "WindowsMenuItemUI", 193 "MenuBarUI", windowsPackageName + "WindowsMenuBarUI", 194 "PopupMenuUI", windowsPackageName + "WindowsPopupMenuUI", 195 "PopupMenuSeparatorUI", windowsPackageName + "WindowsPopupMenuSeparatorUI", 196 "ScrollBarUI", windowsPackageName + "WindowsScrollBarUI", 197 "RootPaneUI", windowsPackageName + "WindowsRootPaneUI" 198 }; 199 200 table.putDefaults(uiDefaults); 201 } 202 203 211 protected void initSystemColorDefaults(UIDefaults table) 212 { 213 String [] defaultSystemColors = { 214 "desktop", "#005C5C", 215 "activeCaption", "#000080", 216 "activeCaptionText", "#FFFFFF", 217 "activeCaptionBorder", "#C0C0C0", 218 "inactiveCaption", "#808080", 219 "inactiveCaptionText", "#C0C0C0", 220 "inactiveCaptionBorder", "#C0C0C0", 221 "window", "#FFFFFF", 222 "windowBorder", "#000000", 223 "windowText", "#000000", 224 "menu", "#C0C0C0", 225 "menuPressedItemB", "#000080", 226 "menuPressedItemF", "#FFFFFF", 227 "menuText", "#000000", 228 "text", "#C0C0C0", 229 "textText", "#000000", 230 "textHighlight", "#000080", 231 "textHighlightText", "#FFFFFF", 232 "textInactiveText", "#808080", 233 "control", "#C0C0C0", 234 "controlText", "#000000", 235 "controlHighlight", "#C0C0C0", 236 237 238 "controlLtHighlight", "#FFFFFF", 239 "controlShadow", "#808080", 240 "controlDkShadow", "#000000", 241 "scrollbar", "#E0E0E0", 242 "info", "#FFFFE1", 243 "infoText", "#000000" 244 }; 245 246 loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel()); 247 } 248 249 253 private void initResourceBundle(UIDefaults table) { 254 table.addResourceBundle( "com.sun.java.swing.plaf.windows.resources.windows" ); 255 } 256 257 protected void initComponentDefaults(UIDefaults table) 260 { 261 super.initComponentDefaults( table ); 262 263 initResourceBundle(table); 264 265 Integer twelve = new Integer (12); 267 Integer eight = new Integer (8); 268 Integer ten = new Integer (10); 269 Integer fontPlain = new Integer (Font.PLAIN); 270 Integer fontBold = new Integer (Font.BOLD); 271 272 Object dialogPlain12 = new SwingLazyValue( 273 "javax.swing.plaf.FontUIResource", 274 null, 275 new Object [] {"Dialog", fontPlain, twelve}); 276 277 Object sansSerifPlain12 = new SwingLazyValue( 278 "javax.swing.plaf.FontUIResource", 279 null, 280 new Object [] {"SansSerif", fontPlain, twelve}); 281 Object monospacedPlain12 = new SwingLazyValue( 282 "javax.swing.plaf.FontUIResource", 283 null, 284 new Object [] {"MonoSpaced", fontPlain, twelve}); 285 Object dialogBold12 = new SwingLazyValue( 286 "javax.swing.plaf.FontUIResource", 287 null, 288 new Object [] {"Dialog", fontBold, twelve}); 289 290 ColorUIResource red = new ColorUIResource(Color.red); 293 ColorUIResource black = new ColorUIResource(Color.black); 294 ColorUIResource white = new ColorUIResource(Color.white); 295 ColorUIResource yellow = new ColorUIResource(Color.yellow); 296 ColorUIResource gray = new ColorUIResource(Color.gray); 297 ColorUIResource lightGray = new ColorUIResource(Color.lightGray); 298 ColorUIResource darkGray = new ColorUIResource(Color.darkGray); 299 ColorUIResource scrollBarTrack = lightGray; 300 ColorUIResource scrollBarTrackHighlight = darkGray; 301 302 String osVersion = System.getProperty("os.version"); 306 if (osVersion != null) { 307 try { 308 Float version = Float.valueOf(osVersion); 309 if (version.floatValue() <= 4.0) { 310 isClassicWindows = true; 311 } else { 312 isClassicWindows = false; 313 } 314 } catch (NumberFormatException ex) { 315 isClassicWindows = false; 316 } 317 } 318 319 ColorUIResource treeSelection = new ColorUIResource(0, 0, 128); 321 Object treeExpandedIcon = WindowsTreeUI.ExpandedIcon.createExpandedIcon(); 322 323 Object treeCollapsedIcon = WindowsTreeUI.CollapsedIcon.createCollapsedIcon(); 324 325 326 Object fieldInputMap = new UIDefaults.LazyInputMap(new Object [] { 328 "control C", DefaultEditorKit.copyAction, 329 "control V", DefaultEditorKit.pasteAction, 330 "control X", DefaultEditorKit.cutAction, 331 "COPY", DefaultEditorKit.copyAction, 332 "PASTE", DefaultEditorKit.pasteAction, 333 "CUT", DefaultEditorKit.cutAction, 334 "control INSERT", DefaultEditorKit.copyAction, 335 "shift INSERT", DefaultEditorKit.pasteAction, 336 "shift DELETE", DefaultEditorKit.cutAction, 337 "control A", DefaultEditorKit.selectAllAction, 338 "control BACK_SLASH", "unselect", 339 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 340 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 341 "control LEFT", DefaultEditorKit.previousWordAction, 342 "control RIGHT", DefaultEditorKit.nextWordAction, 343 "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 344 "control shift RIGHT", DefaultEditorKit.selectionNextWordAction, 345 "HOME", DefaultEditorKit.beginLineAction, 346 "END", DefaultEditorKit.endLineAction, 347 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 348 "shift END", DefaultEditorKit.selectionEndLineAction, 349 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 350 "ctrl H", DefaultEditorKit.deletePrevCharAction, 351 "DELETE", DefaultEditorKit.deleteNextCharAction, 352 "RIGHT", DefaultEditorKit.forwardAction, 353 "LEFT", DefaultEditorKit.backwardAction, 354 "KP_RIGHT", DefaultEditorKit.forwardAction, 355 "KP_LEFT", DefaultEditorKit.backwardAction, 356 "ENTER", JTextField.notifyAction, 357 "control shift O", "toggle-componentOrientation" 358 }); 359 360 Object passwordInputMap = new UIDefaults.LazyInputMap(new Object [] { 361 "control C", DefaultEditorKit.copyAction, 362 "control V", DefaultEditorKit.pasteAction, 363 "control X", DefaultEditorKit.cutAction, 364 "COPY", DefaultEditorKit.copyAction, 365 "PASTE", DefaultEditorKit.pasteAction, 366 "CUT", DefaultEditorKit.cutAction, 367 "control INSERT", DefaultEditorKit.copyAction, 368 "shift INSERT", DefaultEditorKit.pasteAction, 369 "shift DELETE", DefaultEditorKit.cutAction, 370 "control A", DefaultEditorKit.selectAllAction, 371 "control BACK_SLASH", "unselect", 372 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 373 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 374 "control LEFT", DefaultEditorKit.beginLineAction, 375 "control RIGHT", DefaultEditorKit.endLineAction, 376 "control shift LEFT", DefaultEditorKit.selectionBeginLineAction, 377 "control shift RIGHT", DefaultEditorKit.selectionEndLineAction, 378 "HOME", DefaultEditorKit.beginLineAction, 379 "END", DefaultEditorKit.endLineAction, 380 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 381 "shift END", DefaultEditorKit.selectionEndLineAction, 382 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 383 "ctrl H", DefaultEditorKit.deletePrevCharAction, 384 "DELETE", DefaultEditorKit.deleteNextCharAction, 385 "RIGHT", DefaultEditorKit.forwardAction, 386 "LEFT", DefaultEditorKit.backwardAction, 387 "KP_RIGHT", DefaultEditorKit.forwardAction, 388 "KP_LEFT", DefaultEditorKit.backwardAction, 389 "ENTER", JTextField.notifyAction, 390 "control shift O", "toggle-componentOrientation" 391 }); 392 393 Object multilineInputMap = new UIDefaults.LazyInputMap(new Object [] { 394 "control C", DefaultEditorKit.copyAction, 395 "control V", DefaultEditorKit.pasteAction, 396 "control X", DefaultEditorKit.cutAction, 397 "COPY", DefaultEditorKit.copyAction, 398 "PASTE", DefaultEditorKit.pasteAction, 399 "CUT", DefaultEditorKit.cutAction, 400 "control INSERT", DefaultEditorKit.copyAction, 401 "shift INSERT", DefaultEditorKit.pasteAction, 402 "shift DELETE", DefaultEditorKit.cutAction, 403 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 404 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 405 "control LEFT", DefaultEditorKit.previousWordAction, 406 "control RIGHT", DefaultEditorKit.nextWordAction, 407 "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 408 "control shift RIGHT", DefaultEditorKit.selectionNextWordAction, 409 "control A", DefaultEditorKit.selectAllAction, 410 "control BACK_SLASH", "unselect", 411 "HOME", DefaultEditorKit.beginLineAction, 412 "END", DefaultEditorKit.endLineAction, 413 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 414 "shift END", DefaultEditorKit.selectionEndLineAction, 415 "control HOME", DefaultEditorKit.beginAction, 416 "control END", DefaultEditorKit.endAction, 417 "control shift HOME", DefaultEditorKit.selectionBeginAction, 418 "control shift END", DefaultEditorKit.selectionEndAction, 419 "UP", DefaultEditorKit.upAction, 420 "DOWN", DefaultEditorKit.downAction, 421 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 422 "ctrl H", DefaultEditorKit.deletePrevCharAction, 423 "DELETE", DefaultEditorKit.deleteNextCharAction, 424 "RIGHT", DefaultEditorKit.forwardAction, 425 "LEFT", DefaultEditorKit.backwardAction, 426 "KP_RIGHT", DefaultEditorKit.forwardAction, 427 "KP_LEFT", DefaultEditorKit.backwardAction, 428 "PAGE_UP", DefaultEditorKit.pageUpAction, 429 "PAGE_DOWN", DefaultEditorKit.pageDownAction, 430 "shift PAGE_UP", "selection-page-up", 431 "shift PAGE_DOWN", "selection-page-down", 432 "ctrl shift PAGE_UP", "selection-page-left", 433 "ctrl shift PAGE_DOWN", "selection-page-right", 434 "shift UP", DefaultEditorKit.selectionUpAction, 435 "shift DOWN", DefaultEditorKit.selectionDownAction, 436 "ENTER", DefaultEditorKit.insertBreakAction, 437 "TAB", DefaultEditorKit.insertTabAction, 438 "control T", "next-link-action", 439 "control shift T", "previous-link-action", 440 "control SPACE", "activate-link-action", 441 "control shift O", "toggle-componentOrientation" 442 }); 443 444 Object menuItemAcceleratorDelimiter = new String ("+"); 445 446 Object ControlBackgroundColor = new DesktopProperty( 447 "win.3d.backgroundColor", 448 table.get("control"), 449 toolkit); 450 Object ControlLightColor = new DesktopProperty( 451 "win.3d.lightColor", 452 table.get("controlHighlight"), 453 toolkit); 454 Object ControlHighlightColor = new DesktopProperty( 455 "win.3d.highlightColor", 456 table.get("controlLtHighlight"), 457 toolkit); 458 Object ControlShadowColor = new DesktopProperty( 459 "win.3d.shadowColor", 460 table.get("controlShadow"), 461 toolkit); 462 Object ControlDarkShadowColor = new DesktopProperty( 463 "win.3d.darkShadowColor", 464 table.get("controlDkShadow"), 465 toolkit); 466 Object ControlTextColor = new DesktopProperty( 467 "win.button.textColor", 468 table.get("controlText"), 469 toolkit); 470 Object MenuBackgroundColor = new DesktopProperty( 471 "win.menu.backgroundColor", 472 table.get("menu"), 473 toolkit); 474 Object MenuBarBackgroundColor = new DesktopProperty( 475 "win.menubar.backgroundColor", 476 table.get("menu"), 477 toolkit); 478 Object MenuTextColor = new DesktopProperty( 479 "win.menu.textColor", 480 table.get("menuText"), 481 toolkit); 482 Object SelectionBackgroundColor = new DesktopProperty( 483 "win.item.highlightColor", 484 table.get("textHighlight"), 485 toolkit); 486 Object SelectionTextColor = new DesktopProperty( 487 "win.item.highlightTextColor", 488 table.get("textHighlightText"), 489 toolkit); 490 Object WindowBackgroundColor = new DesktopProperty( 491 "win.frame.backgroundColor", 492 table.get("window"), 493 toolkit); 494 Object WindowTextColor = new DesktopProperty( 495 "win.frame.textColor", 496 table.get("windowText"), 497 toolkit); 498 Object WindowBorderWidth = new DesktopProperty( 499 "win.frame.sizingBorderWidth", 500 new Integer (1), 501 toolkit); 502 Object TitlePaneHeight = new DesktopProperty( 503 "win.frame.captionHeight", 504 new Integer (18), 505 toolkit); 506 Object TitleButtonWidth = new DesktopProperty( 507 "win.frame.captionButtonWidth", 508 new Integer (16), 509 toolkit); 510 Object TitleButtonHeight = new DesktopProperty( 511 "win.frame.captionButtonHeight", 512 new Integer (16), 513 toolkit); 514 Object InactiveTextColor = new DesktopProperty( 515 "win.text.grayedTextColor", 516 table.get("textInactiveText"), 517 toolkit); 518 Object ScrollbarBackgroundColor = new DesktopProperty( 519 "win.scrollbar.backgroundColor", 520 table.get("scrollbar"), 521 toolkit); 522 523 Object TextBackground = new XPColorValue( 524 Part.EP_EDIT, null, Prop.FILLCOLOR, 525 WindowBackgroundColor); 526 Object ReadOnlyTextBackground = new XPColorValue( 527 Part.EP_EDITTEXT, State.READONLY, Prop.FILLCOLOR, 528 ControlBackgroundColor); 529 Object DisabledTextBackground = new XPColorValue( 530 Part.EP_EDITTEXT, State.DISABLED, Prop.FILLCOLOR, 531 ControlBackgroundColor); 532 533 Object MenuFont = dialogPlain12; 534 Object FixedControlFont = monospacedPlain12; 535 Object ControlFont = dialogPlain12; 536 Object MessageFont = dialogPlain12; 537 Object WindowFont = dialogBold12; 538 Object ToolTipFont = sansSerifPlain12; 539 Object IconFont = ControlFont; 540 541 Object scrollBarWidth = new DesktopProperty("win.scrollbar.width", 542 new Integer (16), toolkit); 543 544 Object showMnemonics = new DesktopProperty("win.menu.keyboardCuesOn", 545 Boolean.TRUE, toolkit); 546 547 if (useSystemFontSettings) { 548 MenuFont = getDesktopFontValue("win.menu.font", MenuFont, toolkit); 549 FixedControlFont = getDesktopFontValue("win.ansiFixed.font", 550 FixedControlFont, toolkit); 551 ControlFont = getDesktopFontValue("win.defaultGUI.font", 552 ControlFont, toolkit); 553 MessageFont = getDesktopFontValue("win.messagebox.font", 554 MessageFont, toolkit); 555 WindowFont = getDesktopFontValue("win.frame.captionFont", 556 WindowFont, toolkit); 557 IconFont = getDesktopFontValue("win.icon.font", 558 IconFont, toolkit); 559 ToolTipFont = getDesktopFontValue("win.tooltip.font", ToolTipFont, 560 toolkit); 561 } 562 if (useSystemFontSizeSettings) { 563 MenuFont = new WindowsFontSizeProperty("win.menu.font.height", 564 toolkit, "Dialog", Font.PLAIN, 12); 565 FixedControlFont = new WindowsFontSizeProperty( 566 "win.ansiFixed.font.height", toolkit, "MonoSpaced", 567 Font.PLAIN, 12); 568 ControlFont = new WindowsFontSizeProperty( 569 "win.defaultGUI.font.height", toolkit, "Dialog", 570 Font.PLAIN, 12); 571 MessageFont = new WindowsFontSizeProperty( 572 "win.messagebox.font.height", 573 toolkit, "Dialog", Font.PLAIN, 12); 574 WindowFont = new WindowsFontSizeProperty( 575 "win.frame.captionFont.height", toolkit, 576 "Dialog", Font.BOLD, 12); 577 ToolTipFont = new WindowsFontSizeProperty( 578 "win.tooltip.font.height", toolkit, "SansSerif", 579 Font.PLAIN, 12); 580 IconFont = new WindowsFontSizeProperty( 581 "win.icon.font.height", toolkit, "Dialog", 582 Font.PLAIN, 12); 583 } 584 585 586 if (!(this instanceof WindowsClassicLookAndFeel) && 587 (System.getProperty("os.name").startsWith("Windows ") && 588 System.getProperty("os.version").compareTo("5.1") >= 0) && 589 AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) { 590 591 this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive"); 594 this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName"); 595 this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName"); 596 this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName"); 597 } 598 599 600 Object [] defaults = { 601 "AuditoryCues.playList", null, 608 "Application.useSystemFontSettings", Boolean.valueOf(useSystemFontSettings), 609 610 "TextField.focusInputMap", fieldInputMap, 611 "PasswordField.focusInputMap", passwordInputMap, 612 "TextArea.focusInputMap", multilineInputMap, 613 "TextPane.focusInputMap", multilineInputMap, 614 "EditorPane.focusInputMap", multilineInputMap, 615 616 "Button.font", ControlFont, 618 "Button.background", ControlBackgroundColor, 619 "Button.foreground", ControlTextColor, 620 "Button.shadow", ControlShadowColor, 621 "Button.darkShadow", ControlDarkShadowColor, 622 "Button.light", ControlLightColor, 623 "Button.highlight", ControlHighlightColor, 624 "Button.disabledForeground", InactiveTextColor, 625 "Button.disabledShadow", ControlHighlightColor, 626 "Button.focus", black, 627 "Button.dashedRectGapX", new Integer (5), 628 "Button.dashedRectGapY", new Integer (4), 629 "Button.dashedRectGapWidth", new Integer (10), 630 "Button.dashedRectGapHeight", new Integer (8), 631 "Button.textShiftOffset", new Integer (1), 632 "Button.showMnemonics", showMnemonics, 634 "Button.focusInputMap", 635 new UIDefaults.LazyInputMap(new Object [] { 636 "SPACE", "pressed", 637 "released SPACE", "released" 638 }), 639 640 "CheckBox.font", ControlFont, 641 "CheckBox.interiorBackground", WindowBackgroundColor, 642 "CheckBox.background", ControlBackgroundColor, 643 "CheckBox.foreground", ControlTextColor, 644 "CheckBox.shadow", ControlShadowColor, 645 "CheckBox.darkShadow", ControlDarkShadowColor, 646 "CheckBox.light", ControlLightColor, 647 "CheckBox.highlight", ControlHighlightColor, 648 "CheckBox.focus", black, 649 "CheckBox.focusInputMap", 650 new UIDefaults.LazyInputMap(new Object [] { 651 "SPACE", "pressed", 652 "released SPACE", "released" 653 }), 654 655 "CheckBoxMenuItem.font", MenuFont, 656 "CheckBoxMenuItem.background", MenuBackgroundColor, 657 "CheckBoxMenuItem.foreground", MenuTextColor, 658 "CheckBoxMenuItem.selectionForeground", SelectionTextColor, 659 "CheckBoxMenuItem.selectionBackground", SelectionBackgroundColor, 660 "CheckBoxMenuItem.acceleratorForeground", MenuTextColor, 661 "CheckBoxMenuItem.acceleratorSelectionForeground", SelectionTextColor, 662 "CheckBoxMenuItem.commandSound", "win.sound.menuCommand", 663 664 "ComboBox.font", ControlFont, 665 "ComboBox.background", WindowBackgroundColor, 666 "ComboBox.foreground", WindowTextColor, 667 "ComboBox.buttonBackground", ControlBackgroundColor, 668 "ComboBox.buttonShadow", ControlShadowColor, 669 "ComboBox.buttonDarkShadow", ControlDarkShadowColor, 670 "ComboBox.buttonHighlight", ControlHighlightColor, 671 "ComboBox.selectionBackground", SelectionBackgroundColor, 672 "ComboBox.selectionForeground", SelectionTextColor, 673 "ComboBox.disabledBackground", ControlBackgroundColor, 674 "ComboBox.disabledForeground", InactiveTextColor, 675 "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object [] { 676 "ESCAPE", "hidePopup", 677 "PAGE_UP", "pageUpPassThrough", 678 "PAGE_DOWN", "pageDownPassThrough", 679 "HOME", "homePassThrough", 680 "END", "endPassThrough", 681 "DOWN", "selectNext2", 682 "KP_DOWN", "selectNext2", 683 "UP", "selectPrevious2", 684 "KP_UP", "selectPrevious2", 685 "ENTER", "enterPressed", 686 "F4", "togglePopup" 687 }), 688 689 "Desktop.background", new DesktopProperty( 691 "win.desktop.backgroundColor", 692 table.get("desktop"), 693 toolkit), 694 "Desktop.ancestorInputMap", 695 new UIDefaults.LazyInputMap(new Object [] { 696 "ctrl F5", "restore", 697 "ctrl F4", "close", 698 "ctrl F7", "move", 699 "ctrl F8", "resize", 700 "RIGHT", "right", 701 "KP_RIGHT", "right", 702 "LEFT", "left", 703 "KP_LEFT", "left", 704 "UP", "up", 705 "KP_UP", "up", 706 "DOWN", "down", 707 "KP_DOWN", "down", 708 "ESCAPE", "escape", 709 "ctrl F9", "minimize", 710 "ctrl F10", "maximize", 711 "ctrl F6", "selectNextFrame", 712 "ctrl TAB", "selectNextFrame", 713 "ctrl alt F6", "selectNextFrame", 714 "shift ctrl alt F6", "selectPreviousFrame", 715 "ctrl F12", "navigateNext", 716 "shift ctrl F12", "navigatePrevious" 717 }), 718 719 "DesktopIcon.width", new Integer (160), 721 722 "EditorPane.font", ControlFont, 723 "EditorPane.background", WindowBackgroundColor, 724 "EditorPane.foreground", WindowTextColor, 725 "EditorPane.selectionBackground", SelectionBackgroundColor, 726 "EditorPane.selectionForeground", SelectionTextColor, 727 "EditorPane.caretForeground", WindowTextColor, 728 "EditorPane.inactiveForeground", InactiveTextColor, 729 730 "FileChooser.homeFolderIcon", new LazyWindowsIcon(null, 731 "icons/HomeFolder.gif"), 732 "FileChooser.listFont", IconFont, 733 "FileChooser.listViewBackground", new XPColorValue( 734 Part.LVP_LISTVIEW, null, Prop.FILLCOLOR, 735 WindowBackgroundColor), 736 "FileChooser.listViewBorder", new XPBorderValue(Part.LVP_LISTVIEW, 737 new SwingLazyValue( 738 "javax.swing.plaf.BorderUIResource", 739 "getLoweredBevelBorderUIResource")), 740 "FileChooser.listViewIcon", new LazyWindowsIcon("fileChooserIcon ListView", 741 "icons/ListView.gif"), 742 "FileChooser.listViewWindowsStyle", Boolean.TRUE, 743 "FileChooser.detailsViewIcon", new LazyWindowsIcon("fileChooserIcon DetailsView", 744 "icons/DetailsView.gif"), 745 "FileChooser.upFolderIcon", new LazyWindowsIcon("fileChooserIcon UpFolder", 746 "icons/UpFolder.gif"), 747 "FileChooser.newFolderIcon", new LazyWindowsIcon("fileChooserIcon NewFolder", 748 "icons/NewFolder.gif"), 749 "FileChooser.useSystemExtensionHiding", Boolean.TRUE, 750 751 "FileChooser.lookInLabelMnemonic", new Integer (KeyEvent.VK_I), 752 "FileChooser.fileNameLabelMnemonic", new Integer (KeyEvent.VK_N), 753 "FileChooser.filesOfTypeLabelMnemonic", new Integer (KeyEvent.VK_T), 754 "FileChooser.usesSingleFilePane", Boolean.TRUE, 755 "FileChooser.ancestorInputMap", 756 new UIDefaults.LazyInputMap(new Object [] { 757 "ESCAPE", "cancelSelection", 758 "F2", "editFileName", 759 "F5", "refresh", 760 "BACK_SPACE", "Go Up", 761 "ENTER", "approveSelection" 762 }), 763 764 "FileView.directoryIcon", SwingUtilities2.makeIcon(getClass(), 765 WindowsLookAndFeel.class, 766 "icons/Directory.gif"), 767 "FileView.fileIcon", SwingUtilities2.makeIcon(getClass(), 768 WindowsLookAndFeel.class, 769 "icons/File.gif"), 770 "FileView.computerIcon", SwingUtilities2.makeIcon(getClass(), 771 WindowsLookAndFeel.class, 772 "icons/Computer.gif"), 773 "FileView.hardDriveIcon", SwingUtilities2.makeIcon(getClass(), 774 WindowsLookAndFeel.class, 775 "icons/HardDrive.gif"), 776 "FileView.floppyDriveIcon", SwingUtilities2.makeIcon(getClass(), 777 WindowsLookAndFeel.class, 778 "icons/FloppyDrive.gif"), 779 780 "InternalFrame.titleFont", WindowFont, 781 "InternalFrame.titlePaneHeight", TitlePaneHeight, 782 "InternalFrame.titleButtonWidth", TitleButtonWidth, 783 "InternalFrame.titleButtonHeight", TitleButtonHeight, 784 "InternalFrame.borderColor", ControlBackgroundColor, 785 "InternalFrame.borderShadow", ControlShadowColor, 786 "InternalFrame.borderDarkShadow", ControlDarkShadowColor, 787 "InternalFrame.borderHighlight", ControlHighlightColor, 788 "InternalFrame.borderLight", ControlLightColor, 789 "InternalFrame.borderWidth", WindowBorderWidth, 790 "InternalFrame.minimizeIconBackground", ControlBackgroundColor, 791 "InternalFrame.resizeIconHighlight", ControlLightColor, 792 "InternalFrame.resizeIconShadow", ControlShadowColor, 793 "InternalFrame.activeBorderColor", new DesktopProperty( 794 "win.frame.activeBorderColor", 795 table.get("windowBorder"), 796 toolkit), 797 "InternalFrame.inactiveBorderColor", new DesktopProperty( 798 "win.frame.inactiveBorderColor", 799 table.get("windowBorder"), 800 toolkit), 801 "InternalFrame.activeTitleBackground", new DesktopProperty( 802 "win.frame.activeCaptionColor", 803 table.get("activeCaption"), 804 toolkit), 805 "InternalFrame.activeTitleGradient", new DesktopProperty( 806 "win.frame.activeCaptionGradientColor", 807 table.get("activeCaption"), 808 toolkit), 809 "InternalFrame.activeTitleForeground", new DesktopProperty( 810 "win.frame.captionTextColor", 811 table.get("activeCaptionText"), 812 toolkit), 813 "InternalFrame.inactiveTitleBackground", new DesktopProperty( 814 "win.frame.inactiveCaptionColor", 815 table.get("inactiveCaption"), 816 toolkit), 817 "InternalFrame.inactiveTitleGradient", new DesktopProperty( 818 "win.frame.inactiveCaptionGradientColor", 819 table.get("inactiveCaption"), 820 toolkit), 821 "InternalFrame.inactiveTitleForeground", new DesktopProperty( 822 "win.frame.inactiveCaptionTextColor", 823 table.get("inactiveCaptionText"), 824 toolkit), 825 826 "InternalFrame.maximizeIcon", 827 WindowsIconFactory.createFrameMaximizeIcon(), 828 "InternalFrame.minimizeIcon", 829 WindowsIconFactory.createFrameMinimizeIcon(), 830 "InternalFrame.iconifyIcon", 831 WindowsIconFactory.createFrameIconifyIcon(), 832 "InternalFrame.closeIcon", 833 WindowsIconFactory.createFrameCloseIcon(), 834 "InternalFrame.icon", 835 new SwingLazyValue( 836 "com.sun.java.swing.plaf.windows.WindowsInternalFrameTitlePane$ScalableIconUIResource", 837 new Object [][] { { 840 SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"), 841 SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png") 842 } }), 843 844 "InternalFrame.closeSound", "win.sound.close", 846 "InternalFrame.maximizeSound", "win.sound.maximize", 847 "InternalFrame.minimizeSound", "win.sound.minimize", 848 "InternalFrame.restoreDownSound", "win.sound.restoreDown", 849 "InternalFrame.restoreUpSound", "win.sound.restoreUp", 850 851 "InternalFrame.windowBindings", new Object [] { 852 "shift ESCAPE", "showSystemMenu", 853 "ctrl SPACE", "showSystemMenu", 854 "ESCAPE", "hideSystemMenu"}, 855 856 "Label.font", ControlFont, 858 "Label.background", ControlBackgroundColor, 859 "Label.foreground", ControlTextColor, 860 "Label.disabledForeground", InactiveTextColor, 861 "Label.disabledShadow", ControlHighlightColor, 862 863 "List.font", ControlFont, 865 "List.background", WindowBackgroundColor, 866 "List.foreground", WindowTextColor, 867 "List.selectionBackground", SelectionBackgroundColor, 868 "List.selectionForeground", SelectionTextColor, 869 "List.lockToPositionOnScroll", Boolean.TRUE, 870 "List.focusInputMap", 871 new UIDefaults.LazyInputMap(new Object [] { 872 "ctrl C", "copy", 873 "ctrl V", "paste", 874 "ctrl X", "cut", 875 "COPY", "copy", 876 "PASTE", "paste", 877 "CUT", "cut", 878 "UP", "selectPreviousRow", 879 "KP_UP", "selectPreviousRow", 880 "shift UP", "selectPreviousRowExtendSelection", 881 "shift KP_UP", "selectPreviousRowExtendSelection", 882 "ctrl shift UP", "selectPreviousRowExtendSelection", 883 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 884 "ctrl UP", "selectPreviousRowChangeLead", 885 "ctrl KP_UP", "selectPreviousRowChangeLead", 886 "DOWN", "selectNextRow", 887 "KP_DOWN", "selectNextRow", 888 "shift DOWN", "selectNextRowExtendSelection", 889 "shift KP_DOWN", "selectNextRowExtendSelection", 890 "ctrl shift DOWN", "selectNextRowExtendSelection", 891 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 892 "ctrl DOWN", "selectNextRowChangeLead", 893 "ctrl KP_DOWN", "selectNextRowChangeLead", 894 "LEFT", "selectPreviousColumn", 895 "KP_LEFT", "selectPreviousColumn", 896 "shift LEFT", "selectPreviousColumnExtendSelection", 897 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 898 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 899 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 900 "ctrl LEFT", "selectPreviousColumnChangeLead", 901 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 902 "RIGHT", "selectNextColumn", 903 "KP_RIGHT", "selectNextColumn", 904 "shift RIGHT", "selectNextColumnExtendSelection", 905 "shift KP_RIGHT", "selectNextColumnExtendSelection", 906 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 907 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 908 "ctrl RIGHT", "selectNextColumnChangeLead", 909 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 910 "HOME", "selectFirstRow", 911 "shift HOME", "selectFirstRowExtendSelection", 912 "ctrl shift HOME", "selectFirstRowExtendSelection", 913 "ctrl HOME", "selectFirstRowChangeLead", 914 "END", "selectLastRow", 915 "shift END", "selectLastRowExtendSelection", 916 "ctrl shift END", "selectLastRowExtendSelection", 917 "ctrl END", "selectLastRowChangeLead", 918 "PAGE_UP", "scrollUp", 919 "shift PAGE_UP", "scrollUpExtendSelection", 920 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 921 "ctrl PAGE_UP", "scrollUpChangeLead", 922 "PAGE_DOWN", "scrollDown", 923 "shift PAGE_DOWN", "scrollDownExtendSelection", 924 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 925 "ctrl PAGE_DOWN", "scrollDownChangeLead", 926 "ctrl A", "selectAll", 927 "ctrl SLASH", "selectAll", 928 "ctrl BACK_SLASH", "clearSelection", 929 "SPACE", "addToSelection", 930 "ctrl SPACE", "toggleAndAnchor", 931 "shift SPACE", "extendTo", 932 "ctrl shift SPACE", "moveSelectionTo" 933 }), 934 935 "PopupMenu.font", MenuFont, 937 "PopupMenu.background", MenuBackgroundColor, 938 "PopupMenu.foreground", MenuTextColor, 939 "PopupMenu.popupSound", "win.sound.menuPopup", 940 941 "Menu.font", MenuFont, 943 "Menu.foreground", MenuTextColor, 944 "Menu.background", MenuBackgroundColor, 945 "Menu.useMenuBarBackgroundForTopLevel", Boolean.TRUE, 946 "Menu.selectionForeground", SelectionTextColor, 947 "Menu.selectionBackground", SelectionBackgroundColor, 948 "Menu.acceleratorForeground", MenuTextColor, 949 "Menu.acceleratorSelectionForeground", SelectionTextColor, 950 "Menu.menuPopupOffsetX", new Integer (0), 951 "Menu.menuPopupOffsetY", new Integer (0), 952 "Menu.submenuPopupOffsetX", new Integer (-4), 953 "Menu.submenuPopupOffsetY", new Integer (-3), 954 "Menu.crossMenuMnemonic", Boolean.FALSE, 955 956 "MenuBar.font", MenuFont, 958 "MenuBar.background", new XPValue(MenuBarBackgroundColor, 959 MenuBackgroundColor), 960 "MenuBar.foreground", MenuTextColor, 961 "MenuBar.shadow", ControlShadowColor, 962 "MenuBar.highlight", ControlHighlightColor, 963 "MenuBar.windowBindings", new Object [] { 964 "F10", "takeFocus" }, 965 966 "MenuItem.font", MenuFont, 967 "MenuItem.acceleratorFont", MenuFont, 968 "MenuItem.foreground", MenuTextColor, 969 "MenuItem.background", MenuBackgroundColor, 970 "MenuItem.selectionForeground", SelectionTextColor, 971 "MenuItem.selectionBackground", SelectionBackgroundColor, 972 "MenuItem.disabledForeground", InactiveTextColor, 973 "MenuItem.acceleratorForeground", MenuTextColor, 974 "MenuItem.acceleratorSelectionForeground", SelectionTextColor, 975 "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter, 976 "MenuItem.commandSound", "win.sound.menuCommand", 978 979 "RadioButton.font", ControlFont, 980 "RadioButton.interiorBackground", WindowBackgroundColor, 981 "RadioButton.background", ControlBackgroundColor, 982 "RadioButton.foreground", ControlTextColor, 983 "RadioButton.shadow", ControlShadowColor, 984 "RadioButton.darkShadow", ControlDarkShadowColor, 985 "RadioButton.light", ControlLightColor, 986 "RadioButton.highlight", ControlHighlightColor, 987 "RadioButton.focus", black, 988 "RadioButton.focusInputMap", 989 new UIDefaults.LazyInputMap(new Object [] { 990 "SPACE", "pressed", 991 "released SPACE", "released" 992 }), 993 994 995 "RadioButtonMenuItem.font", MenuFont, 996 "RadioButtonMenuItem.foreground", MenuTextColor, 997 "RadioButtonMenuItem.background", MenuBackgroundColor, 998 "RadioButtonMenuItem.selectionForeground", SelectionTextColor, 999 "RadioButtonMenuItem.selectionBackground", SelectionBackgroundColor, 1000 "RadioButtonMenuItem.disabledForeground", InactiveTextColor, 1001 "RadioButtonMenuItem.acceleratorForeground", MenuTextColor, 1002 "RadioButtonMenuItem.acceleratorSelectionForeground", SelectionTextColor, 1003 "RadioButtonMenuItem.commandSound", "win.sound.menuCommand", 1004 1005 "OptionPane.font", MessageFont, 1007 "OptionPane.messageFont", MessageFont, 1008 "OptionPane.buttonFont", MessageFont, 1009 "OptionPane.background", ControlBackgroundColor, 1010 "OptionPane.foreground", ControlTextColor, 1011 "OptionPane.messageForeground", ControlTextColor, 1012 "OptionPane.errorIcon", new LazyWindowsIcon("optionPaneIcon Error", 1013 "icons/Error.gif"), 1014 "OptionPane.informationIcon", new LazyWindowsIcon("optionPaneIcon Information", 1015 "icons/Inform.gif"), 1016 "OptionPane.questionIcon", new LazyWindowsIcon("optionPaneIcon Question", 1017 "icons/Question.gif"), 1018 "OptionPane.warningIcon", new LazyWindowsIcon("optionPaneIcon Warning", 1019 "icons/Warn.gif"), 1020 "OptionPane.windowBindings", new Object [] { 1021 "ESCAPE", "close" }, 1022 "OptionPane.errorSound", "win.sound.hand", "OptionPane.informationSound", "win.sound.asterisk", "OptionPane.questionSound", "win.sound.question", "OptionPane.warningSound", "win.sound.exclamation", 1028 "FormattedTextField.focusInputMap", 1029 new UIDefaults.LazyInputMap(new Object [] { 1030 "ctrl C", DefaultEditorKit.copyAction, 1031 "ctrl V", DefaultEditorKit.pasteAction, 1032 "ctrl X", DefaultEditorKit.cutAction, 1033 "COPY", DefaultEditorKit.copyAction, 1034 "PASTE", DefaultEditorKit.pasteAction, 1035 "CUT", DefaultEditorKit.cutAction, 1036 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 1037 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 1038 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 1039 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 1040 "ctrl LEFT", DefaultEditorKit.previousWordAction, 1041 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 1042 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 1043 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 1044 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 1045 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 1046 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 1047 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 1048 "ctrl A", DefaultEditorKit.selectAllAction, 1049 "HOME", DefaultEditorKit.beginLineAction, 1050 "END", DefaultEditorKit.endLineAction, 1051 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 1052 "shift END", DefaultEditorKit.selectionEndLineAction, 1053 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 1054 "ctrl H", DefaultEditorKit.deletePrevCharAction, 1055 "DELETE", DefaultEditorKit.deleteNextCharAction, 1056 "RIGHT", DefaultEditorKit.forwardAction, 1057 "LEFT", DefaultEditorKit.backwardAction, 1058 "KP_RIGHT", DefaultEditorKit.forwardAction, 1059 "KP_LEFT", DefaultEditorKit.backwardAction, 1060 "ENTER", JTextField.notifyAction, 1061 "ctrl BACK_SLASH", "unselect", 1062 "control shift O", "toggle-componentOrientation", 1063 "ESCAPE", "reset-field-edit", 1064 "UP", "increment", 1065 "KP_UP", "increment", 1066 "DOWN", "decrement", 1067 "KP_DOWN", "decrement", 1068 }), 1069 1070 "Panel.font", ControlFont, 1072 "Panel.background", ControlBackgroundColor, 1073 "Panel.foreground", WindowTextColor, 1074 1075 "PasswordField.font", FixedControlFont, 1077 "PasswordField.background", TextBackground, 1078 "PasswordField.foreground", WindowTextColor, 1079 "PasswordField.inactiveForeground", InactiveTextColor, "PasswordField.inactiveBackground", ReadOnlyTextBackground, "PasswordField.disabledBackground", DisabledTextBackground, "PasswordField.selectionBackground", SelectionBackgroundColor, 1083 "PasswordField.selectionForeground", SelectionTextColor, 1084 "PasswordField.caretForeground",WindowTextColor, 1085 1086 "ProgressBar.font", ControlFont, 1088 "ProgressBar.foreground", SelectionBackgroundColor, 1089 "ProgressBar.background", ControlBackgroundColor, 1090 "ProgressBar.shadow", ControlShadowColor, 1091 "ProgressBar.highlight", ControlHighlightColor, 1092 "ProgressBar.selectionForeground", ControlBackgroundColor, 1093 "ProgressBar.selectionBackground", SelectionBackgroundColor, 1094 "ProgressBar.cellLength", new Integer (7), 1095 "ProgressBar.cellSpacing", new Integer (2), 1096 1097 "RootPane.defaultButtonWindowKeyBindings", new Object [] { 1101 "ENTER", "press", 1102 "released ENTER", "release", 1103 "ctrl ENTER", "press", 1104 "ctrl released ENTER", "release" 1105 }, 1106 1107 "ScrollBar.background", ScrollbarBackgroundColor, 1109 "ScrollBar.foreground", ControlBackgroundColor, 1110 "ScrollBar.track", white, 1111 "ScrollBar.trackForeground", ScrollbarBackgroundColor, 1112 "ScrollBar.trackHighlight", black, 1113 "ScrollBar.trackHighlightForeground", scrollBarTrackHighlight, 1114 "ScrollBar.thumb", ControlBackgroundColor, 1115 "ScrollBar.thumbHighlight", ControlHighlightColor, 1116 "ScrollBar.thumbDarkShadow", ControlDarkShadowColor, 1117 "ScrollBar.thumbShadow", ControlShadowColor, 1118 "ScrollBar.width", scrollBarWidth, 1119 "ScrollBar.ancestorInputMap", 1120 new UIDefaults.LazyInputMap(new Object [] { 1121 "RIGHT", "positiveUnitIncrement", 1122 "KP_RIGHT", "positiveUnitIncrement", 1123 "DOWN", "positiveUnitIncrement", 1124 "KP_DOWN", "positiveUnitIncrement", 1125 "PAGE_DOWN", "positiveBlockIncrement", 1126 "ctrl PAGE_DOWN", "positiveBlockIncrement", 1127 "LEFT", "negativeUnitIncrement", 1128 "KP_LEFT", "negativeUnitIncrement", 1129 "UP", "negativeUnitIncrement", 1130 "KP_UP", "negativeUnitIncrement", 1131 "PAGE_UP", "negativeBlockIncrement", 1132 "ctrl PAGE_UP", "negativeBlockIncrement", 1133 "HOME", "minScroll", 1134 "END", "maxScroll" 1135 }), 1136 1137 "ScrollPane.font", ControlFont, 1139 "ScrollPane.background", ControlBackgroundColor, 1140 "ScrollPane.foreground", ControlTextColor, 1141 "ScrollPane.ancestorInputMap", 1142 new UIDefaults.LazyInputMap(new Object [] { 1143 "RIGHT", "unitScrollRight", 1144 "KP_RIGHT", "unitScrollRight", 1145 "DOWN", "unitScrollDown", 1146 "KP_DOWN", "unitScrollDown", 1147 "LEFT", "unitScrollLeft", 1148 "KP_LEFT", "unitScrollLeft", 1149 "UP", "unitScrollUp", 1150 "KP_UP", "unitScrollUp", 1151 "PAGE_UP", "scrollUp", 1152 "PAGE_DOWN", "scrollDown", 1153 "ctrl PAGE_UP", "scrollLeft", 1154 "ctrl PAGE_DOWN", "scrollRight", 1155 "ctrl HOME", "scrollHome", 1156 "ctrl END", "scrollEnd" 1157 }), 1158 1159 "Separator.background", ControlHighlightColor, 1161 "Separator.foreground", ControlShadowColor, 1162 1163 "Slider.foreground", ControlBackgroundColor, 1165 "Slider.background", ControlBackgroundColor, 1166 "Slider.highlight", ControlHighlightColor, 1167 "Slider.shadow", ControlShadowColor, 1168 "Slider.focus", ControlDarkShadowColor, 1169 "Slider.focusInputMap", 1170 new UIDefaults.LazyInputMap(new Object [] { 1171 "RIGHT", "positiveUnitIncrement", 1172 "KP_RIGHT", "positiveUnitIncrement", 1173 "DOWN", "negativeUnitIncrement", 1174 "KP_DOWN", "negativeUnitIncrement", 1175 "PAGE_DOWN", "negativeBlockIncrement", 1176 "LEFT", "negativeUnitIncrement", 1177 "KP_LEFT", "negativeUnitIncrement", 1178 "UP", "positiveUnitIncrement", 1179 "KP_UP", "positiveUnitIncrement", 1180 "PAGE_UP", "positiveBlockIncrement", 1181 "HOME", "minScroll", 1182 "END", "maxScroll" 1183 }), 1184 1185 "Spinner.font", FixedControlFont, 1187 "Spinner.ancestorInputMap", 1188 new UIDefaults.LazyInputMap(new Object [] { 1189 "UP", "increment", 1190 "KP_UP", "increment", 1191 "DOWN", "decrement", 1192 "KP_DOWN", "decrement", 1193 }), 1194 1195 "SplitPane.background", ControlBackgroundColor, 1197 "SplitPane.highlight", ControlHighlightColor, 1198 "SplitPane.shadow", ControlShadowColor, 1199 "SplitPane.darkShadow", ControlDarkShadowColor, 1200 "SplitPane.dividerSize", new Integer (5), 1201 "SplitPane.ancestorInputMap", 1202 new UIDefaults.LazyInputMap(new Object [] { 1203 "UP", "negativeIncrement", 1204 "DOWN", "positiveIncrement", 1205 "LEFT", "negativeIncrement", 1206 "RIGHT", "positiveIncrement", 1207 "KP_UP", "negativeIncrement", 1208 "KP_DOWN", "positiveIncrement", 1209 "KP_LEFT", "negativeIncrement", 1210 "KP_RIGHT", "positiveIncrement", 1211 "HOME", "selectMin", 1212 "END", "selectMax", 1213 "F8", "startResize", 1214 "F6", "toggleFocus", 1215 "ctrl TAB", "focusOutForward", 1216 "ctrl shift TAB", "focusOutBackward" 1217 }), 1218 1219 "TabbedPane.tabsOverlapBorder", new XPValue(Boolean.TRUE, Boolean.FALSE), 1221 "TabbedPane.tabInsets", new XPValue(new InsetsUIResource(1, 4, 1, 4), 1222 new InsetsUIResource(0, 4, 1, 4)), 1223 "TabbedPane.tabAreaInsets", new XPValue(new InsetsUIResource(3, 2, 2, 2), 1224 new InsetsUIResource(3, 2, 0, 2)), 1225 "TabbedPane.font", ControlFont, 1226 "TabbedPane.background", ControlBackgroundColor, 1227 "TabbedPane.foreground", ControlTextColor, 1228 "TabbedPane.highlight", ControlHighlightColor, 1229 "TabbedPane.light", ControlLightColor, 1230 "TabbedPane.shadow", ControlShadowColor, 1231 "TabbedPane.darkShadow", ControlDarkShadowColor, 1232 "TabbedPane.focus", ControlTextColor, 1233 "TabbedPane.focusInputMap", 1234 new UIDefaults.LazyInputMap(new Object [] { 1235 "RIGHT", "navigateRight", 1236 "KP_RIGHT", "navigateRight", 1237 "LEFT", "navigateLeft", 1238 "KP_LEFT", "navigateLeft", 1239 "UP", "navigateUp", 1240 "KP_UP", "navigateUp", 1241 "DOWN", "navigateDown", 1242 "KP_DOWN", "navigateDown", 1243 "ctrl DOWN", "requestFocusForVisibleComponent", 1244 "ctrl KP_DOWN", "requestFocusForVisibleComponent", 1245 }), 1246 "TabbedPane.ancestorInputMap", 1247 new UIDefaults.LazyInputMap(new Object [] { 1248 "ctrl TAB", "navigateNext", 1249 "ctrl shift TAB", "navigatePrevious", 1250 "ctrl PAGE_DOWN", "navigatePageDown", 1251 "ctrl PAGE_UP", "navigatePageUp", 1252 "ctrl UP", "requestFocus", 1253 "ctrl KP_UP", "requestFocus", 1254 }), 1255 1256 "Table.font", ControlFont, 1258 "Table.foreground", ControlTextColor, "Table.background", WindowBackgroundColor, "Table.highlight", ControlHighlightColor, 1261 "Table.light", ControlLightColor, 1262 "Table.shadow", ControlShadowColor, 1263 "Table.darkShadow", ControlDarkShadowColor, 1264 "Table.selectionForeground", SelectionTextColor, 1265 "Table.selectionBackground", SelectionBackgroundColor, 1266 "Table.gridColor", gray, "Table.focusCellBackground", WindowBackgroundColor, 1268 "Table.focusCellForeground", ControlTextColor, 1269 "Table.ancestorInputMap", 1270 new UIDefaults.LazyInputMap(new Object [] { 1271 "ctrl C", "copy", 1272 "ctrl V", "paste", 1273 "ctrl X", "cut", 1274 "COPY", "copy", 1275 "PASTE", "paste", 1276 "CUT", "cut", 1277 "RIGHT", "selectNextColumn", 1278 "KP_RIGHT", "selectNextColumn", 1279 "shift RIGHT", "selectNextColumnExtendSelection", 1280 "shift KP_RIGHT", "selectNextColumnExtendSelection", 1281 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 1282 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 1283 "ctrl RIGHT", "selectNextColumnChangeLead", 1284 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 1285 "LEFT", "selectPreviousColumn", 1286 "KP_LEFT", "selectPreviousColumn", 1287 "shift LEFT", "selectPreviousColumnExtendSelection", 1288 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 1289 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 1290 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 1291 "ctrl LEFT", "selectPreviousColumnChangeLead", 1292 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 1293 "DOWN", "selectNextRow", 1294 "KP_DOWN", "selectNextRow", 1295 "shift DOWN", "selectNextRowExtendSelection", 1296 "shift KP_DOWN", "selectNextRowExtendSelection", 1297 "ctrl shift DOWN", "selectNextRowExtendSelection", 1298 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 1299 "ctrl DOWN", "selectNextRowChangeLead", 1300 "ctrl KP_DOWN", "selectNextRowChangeLead", 1301 "UP", "selectPreviousRow", 1302 "KP_UP", "selectPreviousRow", 1303 "shift UP", "selectPreviousRowExtendSelection", 1304 "shift KP_UP", "selectPreviousRowExtendSelection", 1305 "ctrl shift UP", "selectPreviousRowExtendSelection", 1306 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 1307 "ctrl UP", "selectPreviousRowChangeLead", 1308 "ctrl KP_UP", "selectPreviousRowChangeLead", 1309 "HOME", "selectFirstColumn", 1310 "shift HOME", "selectFirstColumnExtendSelection", 1311 "ctrl shift HOME", "selectFirstRowExtendSelection", 1312 "ctrl HOME", "selectFirstRow", 1313 "END", "selectLastColumn", 1314 "shift END", "selectLastColumnExtendSelection", 1315 "ctrl shift END", "selectLastRowExtendSelection", 1316 "ctrl END", "selectLastRow", 1317 "PAGE_UP", "scrollUpChangeSelection", 1318 "shift PAGE_UP", "scrollUpExtendSelection", 1319 "ctrl shift PAGE_UP", "scrollLeftExtendSelection", 1320 "ctrl PAGE_UP", "scrollLeftChangeSelection", 1321 "PAGE_DOWN", "scrollDownChangeSelection", 1322 "shift PAGE_DOWN", "scrollDownExtendSelection", 1323 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", 1324 "ctrl PAGE_DOWN", "scrollRightChangeSelection", 1325 "TAB", "selectNextColumnCell", 1326 "shift TAB", "selectPreviousColumnCell", 1327 "ENTER", "selectNextRowCell", 1328 "shift ENTER", "selectPreviousRowCell", 1329 "ctrl A", "selectAll", 1330 "ctrl SLASH", "selectAll", 1331 "ctrl BACK_SLASH", "clearSelection", 1332 "ESCAPE", "cancel", 1333 "F2", "startEditing", 1334 "SPACE", "addToSelection", 1335 "ctrl SPACE", "toggleAndAnchor", 1336 "shift SPACE", "extendTo", 1337 "ctrl shift SPACE", "moveSelectionTo" 1338 }), 1339 1340 "TableHeader.font", ControlFont, 1341 "TableHeader.foreground", ControlTextColor, "TableHeader.background", ControlBackgroundColor, 1344 "TextArea.font", FixedControlFont, 1346 "TextArea.background", WindowBackgroundColor, 1347 "TextArea.foreground", WindowTextColor, 1348 "TextArea.inactiveForeground", InactiveTextColor, 1349 "TextArea.selectionBackground", SelectionBackgroundColor, 1350 "TextArea.selectionForeground", SelectionTextColor, 1351 "TextArea.caretForeground", WindowTextColor, 1352 1353 "TextField.font", ControlFont, 1355 "TextField.background", TextBackground, 1356 "TextField.foreground", WindowTextColor, 1357 "TextField.shadow", ControlShadowColor, 1358 "TextField.darkShadow", ControlDarkShadowColor, 1359 "TextField.light", ControlLightColor, 1360 "TextField.highlight", ControlHighlightColor, 1361 "TextField.inactiveForeground", InactiveTextColor, "TextField.inactiveBackground", ReadOnlyTextBackground, "TextField.disabledBackground", DisabledTextBackground, "TextField.selectionBackground", SelectionBackgroundColor, 1365 "TextField.selectionForeground", SelectionTextColor, 1366 "TextField.caretForeground", WindowTextColor, 1367 1368 "TextPane.font", ControlFont, 1370 "TextPane.background", WindowBackgroundColor, 1371 "TextPane.foreground", WindowTextColor, 1372 "TextPane.selectionBackground", SelectionBackgroundColor, 1373 "TextPane.selectionForeground", SelectionTextColor, 1374 "TextPane.caretForeground", WindowTextColor, 1375 1376 "TitledBorder.font", ControlFont, 1378 "TitledBorder.titleColor", 1379 new XPColorValue(Part.BP_GROUPBOX, null, Prop.TEXTCOLOR, 1380 ControlTextColor), 1381 1382 "ToggleButton.font", ControlFont, 1384 "ToggleButton.background", ControlBackgroundColor, 1385 "ToggleButton.foreground", ControlTextColor, 1386 "ToggleButton.shadow", ControlShadowColor, 1387 "ToggleButton.darkShadow", ControlDarkShadowColor, 1388 "ToggleButton.light", ControlLightColor, 1389 "ToggleButton.highlight", ControlHighlightColor, 1390 "ToggleButton.focus", ControlTextColor, 1391 "ToggleButton.textShiftOffset", new Integer (1), 1392 "ToggleButton.focusInputMap", 1393 new UIDefaults.LazyInputMap(new Object [] { 1394 "SPACE", "pressed", 1395 "released SPACE", "released" 1396 }), 1397 1398 "ToolBar.font", MenuFont, 1400 "ToolBar.background", ControlBackgroundColor, 1401 "ToolBar.foreground", ControlTextColor, 1402 "ToolBar.shadow", ControlShadowColor, 1403 "ToolBar.darkShadow", ControlDarkShadowColor, 1404 "ToolBar.light", ControlLightColor, 1405 "ToolBar.highlight", ControlHighlightColor, 1406 "ToolBar.dockingBackground", ControlBackgroundColor, 1407 "ToolBar.dockingForeground", red, 1408 "ToolBar.floatingBackground", ControlBackgroundColor, 1409 "ToolBar.floatingForeground", darkGray, 1410 "ToolBar.ancestorInputMap", 1411 new UIDefaults.LazyInputMap(new Object [] { 1412 "UP", "navigateUp", 1413 "KP_UP", "navigateUp", 1414 "DOWN", "navigateDown", 1415 "KP_DOWN", "navigateDown", 1416 "LEFT", "navigateLeft", 1417 "KP_LEFT", "navigateLeft", 1418 "RIGHT", "navigateRight", 1419 "KP_RIGHT", "navigateRight" 1420 }), 1421 "ToolBar.separatorSize", null, 1422 1423 "ToolTip.font", ToolTipFont, 1425 "ToolTip.background", new DesktopProperty( 1426 "win.tooltip.backgroundColor", 1427 table.get("info"), toolkit), 1428 "ToolTip.foreground", new DesktopProperty( 1429 "win.tooltip.textColor", 1430 table.get("infoText"), toolkit), 1431 "ToolBar.rolloverBorderProvider", new BorderProvider() { 1434 public Border getRolloverBorder(AbstractButton b) { 1435 return WindowsToolBarUI.getRolloverBorder(b); 1436 } 1437 }, 1438 1439 "Tree.selectionBorderColor", black, 1441 "Tree.drawDashedFocusIndicator", Boolean.TRUE, 1442 "Tree.lineTypeDashed", Boolean.TRUE, 1443 "Tree.font", ControlFont, 1444 "Tree.background", WindowBackgroundColor, 1445 "Tree.foreground", WindowTextColor, 1446 "Tree.hash", gray, 1447 "Tree.textForeground", WindowTextColor, 1448 "Tree.textBackground", WindowBackgroundColor, 1449 "Tree.selectionForeground", SelectionTextColor, 1450 "Tree.selectionBackground", SelectionBackgroundColor, 1451 "Tree.expandedIcon", treeExpandedIcon, 1452 "Tree.collapsedIcon", treeCollapsedIcon, 1453 "Tree.focusInputMap", 1454 new UIDefaults.LazyInputMap(new Object [] { 1455 "ADD", "expand", 1456 "SUBTRACT", "collapse", 1457 "ctrl C", "copy", 1458 "ctrl V", "paste", 1459 "ctrl X", "cut", 1460 "COPY", "copy", 1461 "PASTE", "paste", 1462 "CUT", "cut", 1463 "UP", "selectPrevious", 1464 "KP_UP", "selectPrevious", 1465 "shift UP", "selectPreviousExtendSelection", 1466 "shift KP_UP", "selectPreviousExtendSelection", 1467 "ctrl shift UP", "selectPreviousExtendSelection", 1468 "ctrl shift KP_UP", "selectPreviousExtendSelection", 1469 "ctrl UP", "selectPreviousChangeLead", 1470 "ctrl KP_UP", "selectPreviousChangeLead", 1471 "DOWN", "selectNext", 1472 "KP_DOWN", "selectNext", 1473 "shift DOWN", "selectNextExtendSelection", 1474 "shift KP_DOWN", "selectNextExtendSelection", 1475 "ctrl shift DOWN", "selectNextExtendSelection", 1476 "ctrl shift KP_DOWN", "selectNextExtendSelection", 1477 "ctrl DOWN", "selectNextChangeLead", 1478 "ctrl KP_DOWN", "selectNextChangeLead", 1479 "RIGHT", "selectChild", 1480 "KP_RIGHT", "selectChild", 1481 "LEFT", "selectParent", 1482 "KP_LEFT", "selectParent", 1483 "PAGE_UP", "scrollUpChangeSelection", 1484 "shift PAGE_UP", "scrollUpExtendSelection", 1485 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 1486 "ctrl PAGE_UP", "scrollUpChangeLead", 1487 "PAGE_DOWN", "scrollDownChangeSelection", 1488 "shift PAGE_DOWN", "scrollDownExtendSelection", 1489 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 1490 "ctrl PAGE_DOWN", "scrollDownChangeLead", 1491 "HOME", "selectFirst", 1492 "shift HOME", "selectFirstExtendSelection", 1493 "ctrl shift HOME", "selectFirstExtendSelection", 1494 "ctrl HOME", "selectFirstChangeLead", 1495 "END", "selectLast", 1496 "shift END", "selectLastExtendSelection", 1497 "ctrl shift END", "selectLastExtendSelection", 1498 "ctrl END", "selectLastChangeLead", 1499 "F2", "startEditing", 1500 "ctrl A", "selectAll", 1501 "ctrl SLASH", "selectAll", 1502 "ctrl BACK_SLASH", "clearSelection", 1503 "ctrl LEFT", "scrollLeft", 1504 "ctrl KP_LEFT", "scrollLeft", 1505 "ctrl RIGHT", "scrollRight", 1506 "ctrl KP_RIGHT", "scrollRight", 1507 "SPACE", "addToSelection", 1508 "ctrl SPACE", "toggleAndAnchor", 1509 "shift SPACE", "extendTo", 1510 "ctrl shift SPACE", "moveSelectionTo" 1511 }), 1512 "Tree.ancestorInputMap", 1513 new UIDefaults.LazyInputMap(new Object [] { 1514 "ESCAPE", "cancel" 1515 }), 1516 1517 "Viewport.font", ControlFont, 1519 "Viewport.background", ControlBackgroundColor, 1520 "Viewport.foreground", WindowTextColor, 1521 1522 1523 }; 1524 1525 table.putDefaults(defaults); 1526 table.putDefaults(getLazyValueDefaults()); 1527 initVistaComponentDefaults(table); 1528 } 1529 1530 static boolean isOnVista() { 1531 boolean rv = false; 1532 String osName = System.getProperty("os.name"); 1533 String osVers = System.getProperty("os.version"); 1534 if (osName != null 1535 && osName.startsWith("Windows") 1536 && osVers != null 1537 && osVers.length() > 0) { 1538 1539 int p = osVers.indexOf('.'); 1540 if (p >= 0) { 1541 osVers = osVers.substring(0, p); 1542 } 1543 1544 try { 1545 rv = (Integer.parseInt(osVers) >= 6); 1546 } catch (NumberFormatException nfe) { 1547 } 1548 } 1549 return rv; 1550 } 1551 private void initVistaComponentDefaults(UIDefaults table) { 1552 if (! isOnVista()) { 1553 return; 1554 } 1555 1556 String [] menuClasses = { "MenuItem", "Menu", 1557 "CheckBoxMenuItem", "RadioButtonMenuItem", 1558 }; 1559 1560 Object menuDefaults[] = new Object [menuClasses.length * 2]; 1561 1562 1563 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1564 String key = menuClasses[i] + ".opaque"; 1565 Object oldValue = table.get(key); 1566 menuDefaults[j++] = key; 1567 menuDefaults[j++] = 1568 new XPValue(Boolean.FALSE, oldValue); 1569 } 1570 table.putDefaults(menuDefaults); 1571 1572 1576 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1577 String key = menuClasses[i] + ".acceleratorSelectionForeground"; 1578 Object oldValue = table.get(key); 1579 menuDefaults[j++] = key; 1580 menuDefaults[j++] = 1581 new XPValue( 1582 table.getColor( 1583 menuClasses[i] + ".acceleratorForeground"), 1584 oldValue); 1585 } 1586 table.putDefaults(menuDefaults); 1587 1588 1589 VistaMenuItemCheckIconFactory menuItemCheckIconFactory = 1590 WindowsIconFactory.getMenuItemCheckIconFactory(); 1591 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1592 String key = menuClasses[i] + ".checkIconFactory"; 1593 Object oldValue = table.get(key); 1594 menuDefaults[j++] = key; 1595 menuDefaults[j++] = 1596 new XPValue(menuItemCheckIconFactory, oldValue); 1597 } 1598 table.putDefaults(menuDefaults); 1599 1600 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1601 String key = menuClasses[i] + ".checkIcon"; 1602 Object oldValue = table.get(key); 1603 menuDefaults[j++] = key; 1604 menuDefaults[j++] = 1605 new XPValue(menuItemCheckIconFactory.getIcon(menuClasses[i]), 1606 oldValue); 1607 } 1608 table.putDefaults(menuDefaults); 1609 1610 1611 1612 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1613 String key = menuClasses[i] + ".evenHeight"; 1614 Object oldValue = table.get(key); 1615 menuDefaults[j++] = key; 1616 menuDefaults[j++] = new XPValue(Boolean.TRUE, oldValue); 1617 } 1618 table.putDefaults(menuDefaults); 1619 1620 1621 InsetsUIResource insets = new InsetsUIResource(0, 0, 0, 0); 1622 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1623 String key = menuClasses[i] + ".margin"; 1624 Object oldValue = table.get(key); 1625 menuDefaults[j++] = key; 1626 menuDefaults[j++] = new XPValue(insets, oldValue); 1627 } 1628 table.putDefaults(menuDefaults); 1629 1630 1631 Integer checkIconOffsetInteger = 1632 Integer.valueOf(0); 1633 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1634 String key = menuClasses[i] + ".checkIconOffset"; 1635 Object oldValue = table.get(key); 1636 menuDefaults[j++] = key; 1637 menuDefaults[j++] = 1638 new XPValue(checkIconOffsetInteger, oldValue); 1639 } 1640 table.putDefaults(menuDefaults); 1641 1642 1643 Object minimumTextOffset = new UIDefaults.ActiveValue() { 1644 public Object createValue(UIDefaults table) { 1645 return VistaMenuItemCheckIconFactory.getIconWidth() 1646 + WindowsPopupMenuUI.getSpanBeforeGutter() 1647 + WindowsPopupMenuUI.getGutterWidth() 1648 + WindowsPopupMenuUI.getSpanAfterGutter(); 1649 } 1650 }; 1651 for (int i = 0, j = 0; i < menuClasses.length; i++) { 1652 String key = menuClasses[i] + ".minimumTextOffset"; 1653 Object oldValue = table.get(key); 1654 menuDefaults[j++] = key; 1655 menuDefaults[j++] = new XPValue(minimumTextOffset, oldValue); 1656 } 1657 table.putDefaults(menuDefaults); 1658 1659 1662 String POPUP_MENU_BORDER = "PopupMenu.border"; 1663 1664 Object popupMenuBorder = new XPBorderValue(Part.MENU, 1665 new SwingLazyValue( 1666 "javax.swing.plaf.basic.BasicBorders", 1667 "getInternalFrameBorder"), 1668 BorderFactory.createEmptyBorder(2, 2, 2, 2)); 1669 table.put(POPUP_MENU_BORDER, popupMenuBorder); 1670 1671 } 1672 1673 1679 private Object getDesktopFontValue(String fontName, Object backup, 1680 Toolkit kit) { 1681 if (useSystemFontSettings) { 1682 return new WindowsFontProperty(fontName, backup, kit); 1683 } 1684 return null; 1685 } 1686 1687 private Object [] getLazyValueDefaults() { 1692 1693 Object buttonBorder = 1694 new XPBorderValue(Part.BP_PUSHBUTTON, 1695 new SwingLazyValue( 1696 "javax.swing.plaf.basic.BasicBorders", 1697 "getButtonBorder")); 1698 1699 Object textFieldBorder = 1700 new XPBorderValue(Part.EP_EDIT, 1701 new SwingLazyValue( 1702 "javax.swing.plaf.basic.BasicBorders", 1703 "getTextFieldBorder")); 1704 1705 Object textFieldMargin = 1706 new XPValue(new InsetsUIResource(1, 5, 2, 4), 1707 new InsetsUIResource(1, 1, 1, 1)); 1708 1709 Object spinnerBorder = textFieldBorder; 1710 1711 Object comboBoxBorder = 1712 new XPBorderValue(Part.CP_COMBOBOX, textFieldBorder); 1713 1714 Object focusCellHighlightBorder = new SwingLazyValue( 1716 "com.sun.java.swing.plaf.windows.WindowsBorders", 1717 "getFocusCellHighlightBorder"); 1718 1719 Object etchedBorder = new SwingLazyValue( 1720 "javax.swing.plaf.BorderUIResource", 1721 "getEtchedBorderUIResource"); 1722 1723 Object internalFrameBorder = new SwingLazyValue( 1724 "com.sun.java.swing.plaf.windows.WindowsBorders", 1725 "getInternalFrameBorder"); 1726 1727 Object loweredBevelBorder = new SwingLazyValue( 1728 "javax.swing.plaf.BorderUIResource", 1729 "getLoweredBevelBorderUIResource"); 1730 1731 1732 Object marginBorder = new SwingLazyValue( 1733 "javax.swing.plaf.basic.BasicBorders$MarginBorder"); 1734 1735 Object menuBarBorder = new SwingLazyValue( 1736 "javax.swing.plaf.basic.BasicBorders", 1737 "getMenuBarBorder"); 1738 1739 1740 Object popupMenuBorder = new XPBorderValue(Part.MENU, 1741 new SwingLazyValue( 1742 "javax.swing.plaf.basic.BasicBorders", 1743 "getInternalFrameBorder")); 1744 1745 Object progressBarBorder = new SwingLazyValue( 1747 "com.sun.java.swing.plaf.windows.WindowsBorders", 1748 "getProgressBarBorder"); 1749 1750 Object radioButtonBorder = new SwingLazyValue( 1751 "javax.swing.plaf.basic.BasicBorders", 1752 "getRadioButtonBorder"); 1753 1754 Object scrollPaneBorder = 1755 new XPBorderValue(Part.LBP_LISTBOX, textFieldBorder); 1756 1757 Object tableScrollPaneBorder = 1758 new XPBorderValue(Part.LBP_LISTBOX, loweredBevelBorder); 1759 1760 Object tableHeaderBorder = new SwingLazyValue( 1761 "com.sun.java.swing.plaf.windows.WindowsBorders", 1762 "getTableHeaderBorder"); 1763 1764 Object toolBarBorder = new SwingLazyValue( 1766 "com.sun.java.swing.plaf.windows.WindowsBorders", 1767 "getToolBarBorder"); 1768 1769 Object toolTipBorder = new SwingLazyValue( 1771 "javax.swing.plaf.BorderUIResource", 1772 "getBlackLineBorderUIResource"); 1773 1774 1775 1776 Object checkBoxIcon = new SwingLazyValue( 1777 "com.sun.java.swing.plaf.windows.WindowsIconFactory", 1778 "getCheckBoxIcon"); 1779 1780 Object radioButtonIcon = new SwingLazyValue( 1781 "com.sun.java.swing.plaf.windows.WindowsIconFactory", 1782 "getRadioButtonIcon"); 1783 1784 Object menuItemCheckIcon = new SwingLazyValue( 1785 "com.sun.java.swing.plaf.windows.WindowsIconFactory", 1786 "getMenuItemCheckIcon"); 1787 1788 Object menuItemArrowIcon = new SwingLazyValue( 1789 "com.sun.java.swing.plaf.windows.WindowsIconFactory", 1790 "getMenuItemArrowIcon"); 1791 1792 Object menuArrowIcon = new SwingLazyValue( 1793 "com.sun.java.swing.plaf.windows.WindowsIconFactory", 1794 "getMenuArrowIcon"); 1795 1796 1797 Object [] lazyDefaults = { 1798 "Button.border", buttonBorder, 1799 "CheckBox.border", radioButtonBorder, 1800 "ComboBox.border", comboBoxBorder, 1801 "DesktopIcon.border", internalFrameBorder, 1802 "FormattedTextField.border", textFieldBorder, 1803 "FormattedTextField.margin", textFieldMargin, 1804 "InternalFrame.border", internalFrameBorder, 1805 "List.focusCellHighlightBorder", focusCellHighlightBorder, 1806 "Table.focusCellHighlightBorder", focusCellHighlightBorder, 1807 "Menu.border", marginBorder, 1808 "MenuBar.border", menuBarBorder, 1809 "MenuItem.border", marginBorder, 1810 "PasswordField.border", textFieldBorder, 1811 "PasswordField.margin", textFieldMargin, 1812 "PopupMenu.border", popupMenuBorder, 1813 "ProgressBar.border", progressBarBorder, 1814 "RadioButton.border", radioButtonBorder, 1815 "ScrollPane.border", scrollPaneBorder, 1816 "Spinner.border", spinnerBorder, 1817 "Table.scrollPaneBorder", tableScrollPaneBorder, 1818 "TableHeader.cellBorder", tableHeaderBorder, 1819 "TextField.border", textFieldBorder, 1820 "TextField.margin", textFieldMargin, 1821 "TitledBorder.border", 1822 new XPBorderValue(Part.BP_GROUPBOX, etchedBorder), 1823 "ToggleButton.border", radioButtonBorder, 1824 "ToolBar.border", toolBarBorder, 1825 "ToolTip.border", toolTipBorder, 1826 1827 "CheckBox.icon", checkBoxIcon, 1828 "Menu.arrowIcon", menuArrowIcon, 1829 "MenuItem.checkIcon", menuItemCheckIcon, 1830 "MenuItem.arrowIcon", menuItemArrowIcon, 1831 "RadioButton.icon", radioButtonIcon, 1832 "InternalFrame.layoutTitlePaneAtOrigin", 1833 new XPValue(Boolean.TRUE, Boolean.FALSE), 1834 1835 }; 1836 1837 return lazyDefaults; 1838 } 1839 1840 public void uninitialize() { 1841 super.uninitialize(); 1842 toolkit = null; 1843 1844 if (WindowsPopupMenuUI.mnemonicListener != null) { 1845 MenuSelectionManager.defaultManager(). 1846 removeChangeListener(WindowsPopupMenuUI.mnemonicListener); 1847 } 1848 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 1849 removeKeyEventPostProcessor(WindowsRootPaneUI.altProcessor); 1850 DesktopProperty.flushUnreferencedProperties(); 1851 } 1852 1853 1854 private static boolean isMnemonicHidden = true; 1856 1857 private static boolean isClassicWindows = false; 1860 1861 1870 public static void setMnemonicHidden(boolean hide) { 1871 if (UIManager.getBoolean("Button.showMnemonics") == true) { 1872 isMnemonicHidden = false; 1874 } else { 1875 isMnemonicHidden = hide; 1876 } 1877 } 1878 1879 1887 public static boolean isMnemonicHidden() { 1888 if (UIManager.getBoolean("Button.showMnemonics") == true) { 1889 isMnemonicHidden = false; 1891 } 1892 return isMnemonicHidden; 1893 } 1894 1895 1905 public static boolean isClassicWindows() { 1906 return isClassicWindows; 1907 } 1908 1909 1930 public void provideErrorFeedback(Component component) { 1931 super.provideErrorFeedback(component); 1932 } 1933 1934 1936 1955 protected Action createAudioAction(Object key) { 1956 if (key != null) { 1957 String audioKey = (String )key; 1958 String audioValue = (String )UIManager.get(key); 1959 return new AudioAction(audioKey, audioValue); 1960 } else { 1961 return null; 1962 } 1963 } 1964 1965 static void repaintRootPane(Component c) { 1966 JRootPane root = null; 1967 for (; c != null; c = c.getParent()) { 1968 if (c instanceof JRootPane) { 1969 root = (JRootPane)c; 1970 } 1971 } 1972 1973 if (root != null) { 1974 root.repaint(); 1975 } else { 1976 c.repaint(); 1977 } 1978 } 1979 1980 1991 private static class AudioAction extends AbstractAction { 1992 private Runnable audioRunnable; 1993 private String audioResource; 1994 1998 public AudioAction(String name, String resource) { 1999 super(name); 2000 audioResource = resource; 2001 } 2002 public void actionPerformed(ActionEvent e) { 2003 if (audioRunnable == null) { 2004 audioRunnable = (Runnable )Toolkit.getDefaultToolkit().getDesktopProperty(audioResource); 2005 } 2006 if (audioRunnable != null) { 2007 new Thread (audioRunnable).start(); 2010 } 2011 } 2012 } 2013 2014 2018 private static class LazyWindowsIcon implements UIDefaults.LazyValue { 2019 private String nativeImage; 2020 private String resource; 2021 2022 LazyWindowsIcon(String nativeImage, String resource) { 2023 this.nativeImage = nativeImage; 2024 this.resource = resource; 2025 } 2026 2027 public Object createValue(UIDefaults table) { 2028 if (nativeImage != null) { 2029 Image image = (Image)ShellFolder.get(nativeImage); 2030 if (image != null) { 2031 return new ImageIcon(image); 2032 } 2033 } 2034 return SwingUtilities2.makeIcon(getClass(), 2035 WindowsLookAndFeel.class, 2036 resource); 2037 } 2038 } 2039 2040 2041 2045 private static class WindowsFontProperty extends DesktopProperty { 2046 WindowsFontProperty(String key, Object backup, Toolkit kit) { 2047 super(key, backup, kit); 2048 } 2049 2050 protected Object configureValue(Object value) { 2051 if (value instanceof Font ) { 2052 Font font = (Font )value; 2053 if ("MS Sans Serif".equals(font.getName())) { 2054 int size = font.getSize(); 2055 int dpi; 2059 try { 2060 dpi = Toolkit.getDefaultToolkit().getScreenResolution(); 2061 } catch (HeadlessException ex) { 2062 dpi = 96; 2063 } 2064 if (Math.round(size * 72F / dpi) < 8) { 2065 size = Math.round(8 * dpi / 72F); 2066 } 2067 Font msFont = new FontUIResource("Microsoft Sans Serif", 2068 font.getStyle(), size); 2069 if (msFont.getName() != null && 2070 msFont.getName().equals(msFont.getFamily())) { 2071 font = msFont; 2072 } else if (size != font.getSize()) { 2073 font = new FontUIResource("MS Sans Serif", 2074 font.getStyle(), size); 2075 } 2076 } 2077 if (FontManager.fontSupportsDefaultEncoding(font)) { 2078 if (!(font instanceof UIResource)) { 2079 font = new FontUIResource(font); 2080 } 2081 } 2082 else { 2083 font = FontManager.getCompositeFontUIResource(font); 2084 } 2085 return font; 2086 2087 } 2088 return super.configureValue(value); 2089 } 2090 } 2091 2092 2093 2097 private static class WindowsFontSizeProperty extends DesktopProperty { 2098 private String fontName; 2099 private int fontSize; 2100 private int fontStyle; 2101 2102 WindowsFontSizeProperty(String key, Toolkit toolkit, String fontName, 2103 int fontStyle, int fontSize) { 2104 super(key, null, toolkit); 2105 this.fontName = fontName; 2106 this.fontSize = fontSize; 2107 this.fontStyle = fontStyle; 2108 } 2109 2110 protected Object configureValue(Object value) { 2111 if (value == null) { 2112 value = new FontUIResource(fontName, fontStyle, fontSize); 2113 } 2114 else if (value instanceof Integer ) { 2115 value = new FontUIResource(fontName, fontStyle, 2116 ((Integer )value).intValue()); 2117 } 2118 return value; 2119 } 2120 } 2121 2122 2123 2127 private static class XPValue implements UIDefaults.ActiveValue { 2128 protected Object classicValue, xpValue; 2129 2130 XPValue(Object xpValue, Object classicValue) { 2131 this.xpValue = xpValue; 2132 this.classicValue = classicValue; 2133 } 2134 2135 public Object createValue(UIDefaults table) { 2136 Object value = null; 2137 if (XPStyle.getXP() != null) { 2138 value = getXPValue(table); 2139 } 2140 return (value != null) ? value : getClassicValue(table); 2141 } 2142 2143 protected Object getXPValue(UIDefaults table) { 2144 return recursiveCreateValue(xpValue, table); 2145 } 2146 2147 protected Object getClassicValue(UIDefaults table) { 2148 return recursiveCreateValue(classicValue, table); 2149 } 2150 2151 private Object recursiveCreateValue(Object value, UIDefaults table) { 2152 if (value instanceof UIDefaults.LazyValue) { 2153 value = ((UIDefaults.LazyValue)value).createValue(table); 2154 } 2155 if (value instanceof UIDefaults.ActiveValue) { 2156 return ((UIDefaults.ActiveValue)value).createValue(table); 2157 } else { 2158 return value; 2159 } 2160 } 2161 } 2162 2163 private static class XPBorderValue extends XPValue { 2164 private final Border extraMargin; 2165 2166 XPBorderValue(Part xpValue, Object classicValue) { 2167 this(xpValue, classicValue, null); 2168 } 2169 2170 XPBorderValue(Part xpValue, Object classicValue, Border extraMargin) { 2171 super(xpValue, classicValue); 2172 this.extraMargin = extraMargin; 2173 } 2174 2175 public Object getXPValue(UIDefaults table) { 2176 Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue); 2177 if (extraMargin != null) { 2178 return new BorderUIResource. 2179 CompoundBorderUIResource(xpBorder, extraMargin); 2180 } else { 2181 return xpBorder; 2182 } 2183 } 2184 } 2185 2186 private static class XPColorValue extends XPValue { 2187 XPColorValue(Part part, State state, Prop prop, Object classicValue) { 2188 super(new XPColorValueKey(part, state, prop), classicValue); 2189 } 2190 2191 public Object getXPValue(UIDefaults table) { 2192 XPColorValueKey key = (XPColorValueKey)xpValue; 2193 return XPStyle.getXP().getColor(key.skin, key.prop, null); 2194 } 2195 2196 private static class XPColorValueKey { 2197 Skin skin; 2198 Prop prop; 2199 2200 XPColorValueKey(Part part, State state, Prop prop) { 2201 this.skin = new Skin(part, state); 2202 this.prop = prop; 2203 } 2204 } 2205 } 2206 2207 private class TriggerDesktopProperty extends DesktopProperty { 2208 TriggerDesktopProperty(String key) { 2209 super(key, null, toolkit); 2210 getValueFromDesktop(); 2214 } 2215 2216 protected void updateUI() { 2217 super.updateUI(); 2218 2219 getValueFromDesktop(); 2221 } 2222 } 2223} 2224 | Popular Tags |