1 7 8 package javax.swing.plaf.metal; 9 10 import java.awt.*; 11 import javax.swing.plaf.*; 12 import javax.swing.*; 13 import javax.swing.plaf.basic.*; 14 import javax.swing.border.*; 15 import javax.swing.text.JTextComponent ; 16 import javax.swing.text.DefaultEditorKit ; 17 import java.util.*; 18 19 import java.awt.Font ; 20 import java.awt.Color ; 21 import java.awt.SystemColor ; 22 import java.awt.event.KeyEvent ; 23 import java.awt.event.InputEvent ; 24 import java.lang.reflect.*; 25 import java.net.URL ; 26 import java.io.Serializable ; 27 28 import java.security.AccessController ; 29 import java.security.PrivilegedAction ; 30 import sun.awt.AppContext; 31 import sun.security.action.GetPropertyAction; 32 import sun.swing.SwingLazyValue; 33 34 35 79 public class MetalLookAndFeel extends BasicLookAndFeel 80 { 81 82 private static boolean METAL_LOOK_AND_FEEL_INITED = false; 83 84 private static MetalTheme currentTheme; 85 private static boolean isOnlyOneContext = true; 86 private static AppContext cachedAppContext; 87 88 91 private static boolean checkedWindows; 92 95 private static boolean isWindows; 96 97 100 private static boolean checkedSystemFontSettings; 101 102 106 private static boolean useSystemFonts; 107 108 109 112 static boolean isWindows() { 113 if (!checkedWindows) { 114 String osName = (String )AccessController.doPrivileged( 115 new GetPropertyAction("os.name")); 116 if (osName != null && osName.indexOf("Windows") != -1) { 117 isWindows = true; 118 String systemFonts = (String )AccessController.doPrivileged( 119 new GetPropertyAction("swing.useSystemFontSettings")); 120 useSystemFonts = (systemFonts != null && 121 (Boolean.valueOf(systemFonts).booleanValue())); 122 } 123 checkedWindows = true; 124 } 125 return isWindows; 126 } 127 128 132 static boolean useSystemFonts() { 133 if (isWindows() && useSystemFonts) { 134 if (METAL_LOOK_AND_FEEL_INITED) { 135 Object value = UIManager.get( 136 "Application.useSystemFontSettings"); 137 138 return (value == null || Boolean.TRUE.equals(value)); 139 } 140 return true; 146 } 147 return false; 148 } 149 150 154 private static boolean useHighContrastTheme() { 155 if (isWindows() && useSystemFonts()) { 156 Boolean highContrast = (Boolean )Toolkit.getDefaultToolkit(). 157 getDesktopProperty("win.highContrast.on"); 158 159 return (highContrast == null) ? false : highContrast. 160 booleanValue(); 161 } 162 return false; 163 } 164 165 168 static boolean usingOcean() { 169 return (getCurrentTheme() instanceof OceanTheme ); 170 } 171 172 public String getName() { 173 return "Metal"; 174 } 175 176 public String getID() { 177 return "Metal"; 178 } 179 180 public String getDescription() { 181 return "The Java(tm) Look and Feel"; 182 } 183 184 185 public boolean isNativeLookAndFeel() { 186 return false; 187 } 188 189 190 public boolean isSupportedLookAndFeel() { 191 return true; 192 } 193 194 209 public boolean getSupportsWindowDecorations() { 210 return true; 211 } 212 213 227 protected void initClassDefaults(UIDefaults table) 228 { 229 super.initClassDefaults(table); 230 final String metalPackageName = "javax.swing.plaf.metal."; 231 232 Object [] uiDefaults = { 233 "ButtonUI", metalPackageName + "MetalButtonUI", 234 "CheckBoxUI", metalPackageName + "MetalCheckBoxUI", 235 "ComboBoxUI", metalPackageName + "MetalComboBoxUI", 236 "DesktopIconUI", metalPackageName + "MetalDesktopIconUI", 237 "FileChooserUI", metalPackageName + "MetalFileChooserUI", 238 "InternalFrameUI", metalPackageName + "MetalInternalFrameUI", 239 "LabelUI", metalPackageName + "MetalLabelUI", 240 "PopupMenuSeparatorUI", metalPackageName + "MetalPopupMenuSeparatorUI", 241 "ProgressBarUI", metalPackageName + "MetalProgressBarUI", 242 "RadioButtonUI", metalPackageName + "MetalRadioButtonUI", 243 "ScrollBarUI", metalPackageName + "MetalScrollBarUI", 244 "ScrollPaneUI", metalPackageName + "MetalScrollPaneUI", 245 "SeparatorUI", metalPackageName + "MetalSeparatorUI", 246 "SliderUI", metalPackageName + "MetalSliderUI", 247 "SplitPaneUI", metalPackageName + "MetalSplitPaneUI", 248 "TabbedPaneUI", metalPackageName + "MetalTabbedPaneUI", 249 "TextFieldUI", metalPackageName + "MetalTextFieldUI", 250 "ToggleButtonUI", metalPackageName + "MetalToggleButtonUI", 251 "ToolBarUI", metalPackageName + "MetalToolBarUI", 252 "ToolTipUI", metalPackageName + "MetalToolTipUI", 253 "TreeUI", metalPackageName + "MetalTreeUI", 254 "RootPaneUI", metalPackageName + "MetalRootPaneUI", 255 }; 256 257 table.putDefaults(uiDefaults); 258 } 259 260 265 protected void initSystemColorDefaults(UIDefaults table) 266 { 267 MetalTheme theme = getCurrentTheme(); 268 Color control = theme.getControl(); 269 Object [] systemColors = { 270 "desktop", theme.getDesktopColor(), 271 "activeCaption", theme.getWindowTitleBackground(), 272 "activeCaptionText", theme.getWindowTitleForeground(), 273 "activeCaptionBorder", theme.getPrimaryControlShadow(), 274 "inactiveCaption", theme.getWindowTitleInactiveBackground(), 275 "inactiveCaptionText", theme.getWindowTitleInactiveForeground(), 276 "inactiveCaptionBorder", theme.getControlShadow(), 277 "window", theme.getWindowBackground(), 278 "windowBorder", control, 279 "windowText", theme.getUserTextColor(), 280 "menu", theme.getMenuBackground(), 281 "menuText", theme.getMenuForeground(), 282 "text", theme.getWindowBackground(), 283 "textText", theme.getUserTextColor(), 284 "textHighlight", theme.getTextHighlightColor(), 285 "textHighlightText", theme.getHighlightedTextColor(), 286 "textInactiveText", theme.getInactiveSystemTextColor(), 287 "control", control, 288 "controlText", theme.getControlTextColor(), 289 "controlHighlight", theme.getControlHighlight(), 290 "controlLtHighlight", theme.getControlHighlight(), 291 "controlShadow", theme.getControlShadow(), 292 "controlDkShadow", theme.getControlDarkShadow(), 293 "scrollbar", control, 294 "info", theme.getPrimaryControl(), 295 "infoText", theme.getPrimaryControlInfo() 296 }; 297 298 table.putDefaults(systemColors); 299 } 300 301 305 private void initResourceBundle(UIDefaults table) { 306 table.addResourceBundle( "com.sun.swing.internal.plaf.metal.resources.metal" ); 307 } 308 309 protected void initComponentDefaults(UIDefaults table) { 310 super.initComponentDefaults( table ); 311 312 initResourceBundle(table); 313 314 Color acceleratorForeground = getAcceleratorForeground(); 315 Color acceleratorSelectedForeground = getAcceleratorSelectedForeground(); 316 Color control = getControl(); 317 Color controlHighlight = getControlHighlight(); 318 Color controlShadow = getControlShadow(); 319 Color controlDarkShadow = getControlDarkShadow(); 320 Color controlTextColor = getControlTextColor(); 321 Color focusColor = getFocusColor(); 322 Color inactiveControlTextColor = getInactiveControlTextColor(); 323 Color menuBackground = getMenuBackground(); 324 Color menuSelectedBackground = getMenuSelectedBackground(); 325 Color menuDisabledForeground = getMenuDisabledForeground(); 326 Color menuSelectedForeground = getMenuSelectedForeground(); 327 Color primaryControl = getPrimaryControl(); 328 Color primaryControlDarkShadow = getPrimaryControlDarkShadow(); 329 Color primaryControlShadow = getPrimaryControlShadow(); 330 Color systemTextColor = getSystemTextColor(); 331 332 Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0); 333 334 Integer zero = new Integer (0); 335 336 Object textFieldBorder = 337 new SwingLazyValue("javax.swing.plaf.metal.MetalBorders", 338 "getTextFieldBorder"); 339 340 Object dialogBorder = new MetalLazyValue( 341 "javax.swing.plaf.metal.MetalBorders$DialogBorder"); 342 343 Object questionDialogBorder = new MetalLazyValue( 344 "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder"); 345 346 Object fieldInputMap = new UIDefaults.LazyInputMap(new Object [] { 347 "ctrl C", DefaultEditorKit.copyAction, 348 "ctrl V", DefaultEditorKit.pasteAction, 349 "ctrl X", DefaultEditorKit.cutAction, 350 "COPY", DefaultEditorKit.copyAction, 351 "PASTE", DefaultEditorKit.pasteAction, 352 "CUT", DefaultEditorKit.cutAction, 353 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 354 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 355 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 356 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 357 "ctrl LEFT", DefaultEditorKit.previousWordAction, 358 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 359 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 360 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 361 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 362 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 363 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 364 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 365 "ctrl A", DefaultEditorKit.selectAllAction, 366 "HOME", DefaultEditorKit.beginLineAction, 367 "END", DefaultEditorKit.endLineAction, 368 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 369 "shift END", DefaultEditorKit.selectionEndLineAction, 370 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 371 "ctrl H", DefaultEditorKit.deletePrevCharAction, 372 "DELETE", DefaultEditorKit.deleteNextCharAction, 373 "RIGHT", DefaultEditorKit.forwardAction, 374 "LEFT", DefaultEditorKit.backwardAction, 375 "KP_RIGHT", DefaultEditorKit.forwardAction, 376 "KP_LEFT", DefaultEditorKit.backwardAction, 377 "ENTER", JTextField.notifyAction, 378 "ctrl BACK_SLASH", "unselect", 379 "control shift O", "toggle-componentOrientation" 380 }); 381 382 Object passwordInputMap = new UIDefaults.LazyInputMap(new Object [] { 383 "ctrl C", DefaultEditorKit.copyAction, 384 "ctrl V", DefaultEditorKit.pasteAction, 385 "ctrl X", DefaultEditorKit.cutAction, 386 "COPY", DefaultEditorKit.copyAction, 387 "PASTE", DefaultEditorKit.pasteAction, 388 "CUT", DefaultEditorKit.cutAction, 389 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 390 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 391 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 392 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 393 "ctrl LEFT", DefaultEditorKit.beginLineAction, 394 "ctrl KP_LEFT", DefaultEditorKit.beginLineAction, 395 "ctrl RIGHT", DefaultEditorKit.endLineAction, 396 "ctrl KP_RIGHT", DefaultEditorKit.endLineAction, 397 "ctrl shift LEFT", DefaultEditorKit.selectionBeginLineAction, 398 "ctrl shift KP_LEFT", DefaultEditorKit.selectionBeginLineAction, 399 "ctrl shift RIGHT", DefaultEditorKit.selectionEndLineAction, 400 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionEndLineAction, 401 "ctrl A", DefaultEditorKit.selectAllAction, 402 "HOME", DefaultEditorKit.beginLineAction, 403 "END", DefaultEditorKit.endLineAction, 404 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 405 "shift END", DefaultEditorKit.selectionEndLineAction, 406 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 407 "ctrl H", DefaultEditorKit.deletePrevCharAction, 408 "DELETE", DefaultEditorKit.deleteNextCharAction, 409 "RIGHT", DefaultEditorKit.forwardAction, 410 "LEFT", DefaultEditorKit.backwardAction, 411 "KP_RIGHT", DefaultEditorKit.forwardAction, 412 "KP_LEFT", DefaultEditorKit.backwardAction, 413 "ENTER", JTextField.notifyAction, 414 "ctrl BACK_SLASH", "unselect", 415 "control shift O", "toggle-componentOrientation" 416 }); 417 418 Object multilineInputMap = new UIDefaults.LazyInputMap(new Object [] { 419 "ctrl C", DefaultEditorKit.copyAction, 420 "ctrl V", DefaultEditorKit.pasteAction, 421 "ctrl X", DefaultEditorKit.cutAction, 422 "COPY", DefaultEditorKit.copyAction, 423 "PASTE", DefaultEditorKit.pasteAction, 424 "CUT", DefaultEditorKit.cutAction, 425 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 426 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 427 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 428 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 429 "ctrl LEFT", DefaultEditorKit.previousWordAction, 430 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 431 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 432 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 433 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 434 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 435 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 436 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 437 "ctrl A", DefaultEditorKit.selectAllAction, 438 "HOME", DefaultEditorKit.beginLineAction, 439 "END", DefaultEditorKit.endLineAction, 440 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 441 "shift END", DefaultEditorKit.selectionEndLineAction, 442 443 "UP", DefaultEditorKit.upAction, 444 "KP_UP", DefaultEditorKit.upAction, 445 "DOWN", DefaultEditorKit.downAction, 446 "KP_DOWN", DefaultEditorKit.downAction, 447 "PAGE_UP", DefaultEditorKit.pageUpAction, 448 "PAGE_DOWN", DefaultEditorKit.pageDownAction, 449 "shift PAGE_UP", "selection-page-up", 450 "shift PAGE_DOWN", "selection-page-down", 451 "ctrl shift PAGE_UP", "selection-page-left", 452 "ctrl shift PAGE_DOWN", "selection-page-right", 453 "shift UP", DefaultEditorKit.selectionUpAction, 454 "shift KP_UP", DefaultEditorKit.selectionUpAction, 455 "shift DOWN", DefaultEditorKit.selectionDownAction, 456 "shift KP_DOWN", DefaultEditorKit.selectionDownAction, 457 "ENTER", DefaultEditorKit.insertBreakAction, 458 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 459 "ctrl H", DefaultEditorKit.deletePrevCharAction, 460 "DELETE", DefaultEditorKit.deleteNextCharAction, 461 "RIGHT", DefaultEditorKit.forwardAction, 462 "LEFT", DefaultEditorKit.backwardAction, 463 "KP_RIGHT", DefaultEditorKit.forwardAction, 464 "KP_LEFT", DefaultEditorKit.backwardAction, 465 "TAB", DefaultEditorKit.insertTabAction, 466 "ctrl BACK_SLASH", "unselect", 467 "ctrl HOME", DefaultEditorKit.beginAction, 468 "ctrl END", DefaultEditorKit.endAction, 469 "ctrl shift HOME", DefaultEditorKit.selectionBeginAction, 470 "ctrl shift END", DefaultEditorKit.selectionEndAction, 471 "ctrl T", "next-link-action", 472 "ctrl shift T", "previous-link-action", 473 "ctrl SPACE", "activate-link-action", 474 "control shift O", "toggle-componentOrientation" 475 }); 476 477 Object scrollPaneBorder = new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$ScrollPaneBorder"); 478 Object buttonBorder = 479 new SwingLazyValue("javax.swing.plaf.metal.MetalBorders", 480 "getButtonBorder"); 481 482 Object toggleButtonBorder = 483 new SwingLazyValue("javax.swing.plaf.metal.MetalBorders", 484 "getToggleButtonBorder"); 485 486 Object titledBorderBorder = 487 new SwingLazyValue( 488 "javax.swing.plaf.BorderUIResource$LineBorderUIResource", 489 new Object [] {controlShadow}); 490 491 Object desktopIconBorder = 492 new SwingLazyValue( 493 "javax.swing.plaf.metal.MetalBorders", 494 "getDesktopIconBorder"); 495 496 Object menuBarBorder = 497 new SwingLazyValue( 498 "javax.swing.plaf.metal.MetalBorders$MenuBarBorder"); 499 500 Object popupMenuBorder = 501 new SwingLazyValue( 502 "javax.swing.plaf.metal.MetalBorders$PopupMenuBorder"); 503 Object menuItemBorder = 504 new SwingLazyValue( 505 "javax.swing.plaf.metal.MetalBorders$MenuItemBorder"); 506 507 Object menuItemAcceleratorDelimiter = new String ("-"); 508 Object toolBarBorder = new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$ToolBarBorder"); 509 510 Object progressBarBorder = new SwingLazyValue( 511 "javax.swing.plaf.BorderUIResource$LineBorderUIResource", 512 new Object [] {controlDarkShadow, new Integer (1)}); 513 514 Object toolTipBorder = new SwingLazyValue( 515 "javax.swing.plaf.BorderUIResource$LineBorderUIResource", 516 new Object [] {primaryControlDarkShadow}); 517 518 Object toolTipBorderInactive = new SwingLazyValue( 519 "javax.swing.plaf.BorderUIResource$LineBorderUIResource", 520 new Object [] {controlDarkShadow}); 521 522 Object focusCellHighlightBorder = new SwingLazyValue( 523 "javax.swing.plaf.BorderUIResource$LineBorderUIResource", 524 new Object [] {focusColor}); 525 526 Object tabbedPaneTabAreaInsets = new InsetsUIResource(4, 2, 0, 6); 527 528 Object tabbedPaneTabInsets = new InsetsUIResource(0, 9, 1, 9); 529 530 final Object [] internalFrameIconArgs = new Object [1]; 531 internalFrameIconArgs[0] = new Integer (16); 532 533 Object [] defaultCueList = new Object [] { 534 "OptionPane.errorSound", 535 "OptionPane.informationSound", 536 "OptionPane.questionSound", 537 "OptionPane.warningSound" }; 538 539 MetalTheme theme = getCurrentTheme(); 540 Object menuTextValue = new FontActiveValue(theme, 541 MetalTheme.MENU_TEXT_FONT); 542 Object controlTextValue = new FontActiveValue(theme, 543 MetalTheme.CONTROL_TEXT_FONT); 544 Object userTextValue = new FontActiveValue(theme, 545 MetalTheme.USER_TEXT_FONT); 546 Object windowTitleValue = new FontActiveValue(theme, 547 MetalTheme.WINDOW_TITLE_FONT); 548 Object subTextValue = new FontActiveValue(theme, 549 MetalTheme.SUB_TEXT_FONT); 550 Object systemTextValue = new FontActiveValue(theme, 551 MetalTheme.SYSTEM_TEXT_FONT); 552 556 Object [] defaults = { 557 "AuditoryCues.defaultCueList", defaultCueList, 559 "AuditoryCues.playList", null, 563 "TextField.border", textFieldBorder, 565 "TextField.font", userTextValue, 566 567 "PasswordField.border", textFieldBorder, 568 "PasswordField.font", userTextValue, 571 572 "TextArea.font", userTextValue, 575 576 "TextPane.background", table.get("window"), 577 "TextPane.font", userTextValue, 578 579 "EditorPane.background", table.get("window"), 580 "EditorPane.font", userTextValue, 581 582 "TextField.focusInputMap", fieldInputMap, 583 "PasswordField.focusInputMap", passwordInputMap, 584 "TextArea.focusInputMap", multilineInputMap, 585 "TextPane.focusInputMap", multilineInputMap, 586 "EditorPane.focusInputMap", multilineInputMap, 587 588 "FormattedTextField.border", textFieldBorder, 590 "FormattedTextField.font", userTextValue, 591 "FormattedTextField.focusInputMap", 592 new UIDefaults.LazyInputMap(new Object [] { 593 "ctrl C", DefaultEditorKit.copyAction, 594 "ctrl V", DefaultEditorKit.pasteAction, 595 "ctrl X", DefaultEditorKit.cutAction, 596 "COPY", DefaultEditorKit.copyAction, 597 "PASTE", DefaultEditorKit.pasteAction, 598 "CUT", DefaultEditorKit.cutAction, 599 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 600 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 601 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 602 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 603 "ctrl LEFT", DefaultEditorKit.previousWordAction, 604 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 605 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 606 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 607 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 608 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 609 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 610 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 611 "ctrl A", DefaultEditorKit.selectAllAction, 612 "HOME", DefaultEditorKit.beginLineAction, 613 "END", DefaultEditorKit.endLineAction, 614 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 615 "shift END", DefaultEditorKit.selectionEndLineAction, 616 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 617 "ctrl H", DefaultEditorKit.deletePrevCharAction, 618 "DELETE", DefaultEditorKit.deleteNextCharAction, 619 "RIGHT", DefaultEditorKit.forwardAction, 620 "LEFT", DefaultEditorKit.backwardAction, 621 "KP_RIGHT", DefaultEditorKit.forwardAction, 622 "KP_LEFT", DefaultEditorKit.backwardAction, 623 "ENTER", JTextField.notifyAction, 624 "ctrl BACK_SLASH", "unselect", 625 "control shift O", "toggle-componentOrientation", 626 "ESCAPE", "reset-field-edit", 627 "UP", "increment", 628 "KP_UP", "increment", 629 "DOWN", "decrement", 630 "KP_DOWN", "decrement", 631 }), 632 633 634 "Button.defaultButtonFollowsFocus", Boolean.FALSE, 636 "Button.disabledText", inactiveControlTextColor, 637 "Button.select", controlShadow, 638 "Button.border", buttonBorder, 639 "Button.font", controlTextValue, 640 "Button.focus", focusColor, 641 "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object [] { 642 "SPACE", "pressed", 643 "released SPACE", "released" 644 }), 645 646 "CheckBox.disabledText", inactiveControlTextColor, 647 "Checkbox.select", controlShadow, 648 "CheckBox.font", controlTextValue, 649 "CheckBox.focus", focusColor, 650 "CheckBox.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getCheckBoxIcon"), 651 "CheckBox.focusInputMap", 652 new UIDefaults.LazyInputMap(new Object [] { 653 "SPACE", "pressed", 654 "released SPACE", "released" 655 }), 656 657 "RadioButton.disabledText", inactiveControlTextColor, 658 "RadioButton.select", controlShadow, 659 "RadioButton.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonIcon"), 660 "RadioButton.font", controlTextValue, 661 "RadioButton.focus", focusColor, 662 "RadioButton.focusInputMap", 663 new UIDefaults.LazyInputMap(new Object [] { 664 "SPACE", "pressed", 665 "released SPACE", "released" 666 }), 667 668 "ToggleButton.select", controlShadow, 669 "ToggleButton.disabledText", inactiveControlTextColor, 670 "ToggleButton.focus", focusColor, 671 "ToggleButton.border", toggleButtonBorder, 672 "ToggleButton.font", controlTextValue, 673 "ToggleButton.focusInputMap", 674 new UIDefaults.LazyInputMap(new Object [] { 675 "SPACE", "pressed", 676 "released SPACE", "released" 677 }), 678 679 680 "FileView.directoryIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"), 682 "FileView.fileIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeLeafIcon"), 683 "FileView.computerIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeComputerIcon"), 684 "FileView.hardDriveIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeHardDriveIcon"), 685 "FileView.floppyDriveIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFloppyDriveIcon"), 686 687 "FileChooser.detailsViewIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserDetailViewIcon"), 689 "FileChooser.homeFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserHomeFolderIcon"), 690 "FileChooser.listViewIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserListViewIcon"), 691 "FileChooser.newFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserNewFolderIcon"), 692 "FileChooser.upFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserUpFolderIcon"), 693 694 "FileChooser.lookInLabelMnemonic", new Integer (KeyEvent.VK_I), 695 "FileChooser.fileNameLabelMnemonic", new Integer (KeyEvent.VK_N), 696 "FileChooser.filesOfTypeLabelMnemonic", new Integer (KeyEvent.VK_T), 697 "FileChooser.usesSingleFilePane", Boolean.TRUE, 698 "FileChooser.ancestorInputMap", 699 new UIDefaults.LazyInputMap(new Object [] { 700 "ESCAPE", "cancelSelection", 701 "F2", "editFileName", 702 "F5", "refresh", 703 "BACK_SPACE", "Go Up", 704 "ENTER", "approveSelection" 705 }), 706 707 708 "ToolTip.font", systemTextValue, 710 "ToolTip.border", toolTipBorder, 711 "ToolTip.borderInactive", toolTipBorderInactive, 712 "ToolTip.backgroundInactive", control, 713 "ToolTip.foregroundInactive", controlDarkShadow, 714 "ToolTip.hideAccelerator", Boolean.FALSE, 715 716 "Slider.border", null, 718 "Slider.foreground", primaryControlShadow, 719 "Slider.focus", focusColor, 720 "Slider.focusInsets", zeroInsets, 721 "Slider.trackWidth", new Integer ( 7 ), 722 "Slider.majorTickLength", new Integer ( 6 ), 723 "Slider.horizontalThumbIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getHorizontalSliderThumbIcon"), 724 "Slider.verticalThumbIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getVerticalSliderThumbIcon"), 725 "Slider.focusInputMap", 726 new UIDefaults.LazyInputMap(new Object [] { 727 "RIGHT", "positiveUnitIncrement", 728 "KP_RIGHT", "positiveUnitIncrement", 729 "DOWN", "negativeUnitIncrement", 730 "KP_DOWN", "negativeUnitIncrement", 731 "PAGE_DOWN", "negativeBlockIncrement", 732 "ctrl PAGE_DOWN", "negativeBlockIncrement", 733 "LEFT", "negativeUnitIncrement", 734 "KP_LEFT", "negativeUnitIncrement", 735 "UP", "positiveUnitIncrement", 736 "KP_UP", "positiveUnitIncrement", 737 "PAGE_UP", "positiveBlockIncrement", 738 "ctrl PAGE_UP", "positiveBlockIncrement", 739 "HOME", "minScroll", 740 "END", "maxScroll" 741 }), 742 743 "ProgressBar.font", controlTextValue, 745 "ProgressBar.foreground", primaryControlShadow, 746 "ProgressBar.selectionBackground", primaryControlDarkShadow, 747 "ProgressBar.border", progressBarBorder, 748 "ProgressBar.cellSpacing", zero, 749 "ProgressBar.cellLength", new Integer (1), 750 751 "ComboBox.background", control, 753 "ComboBox.foreground", controlTextColor, 754 "ComboBox.selectionBackground", primaryControlShadow, 755 "ComboBox.selectionForeground", controlTextColor, 756 "ComboBox.font", controlTextValue, 757 "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object [] { 758 "ESCAPE", "hidePopup", 759 "PAGE_UP", "pageUpPassThrough", 760 "PAGE_DOWN", "pageDownPassThrough", 761 "HOME", "homePassThrough", 762 "END", "endPassThrough", 763 "DOWN", "selectNext", 764 "KP_DOWN", "selectNext", 765 "alt DOWN", "togglePopup", 766 "alt KP_DOWN", "togglePopup", 767 "alt UP", "togglePopup", 768 "alt KP_UP", "togglePopup", 769 "SPACE", "spacePopup", 770 "ENTER", "enterPressed", 771 "UP", "selectPrevious", 772 "KP_UP", "selectPrevious" 773 }), 774 775 "InternalFrame.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getInternalFrameDefaultMenuIcon"), 777 "InternalFrame.border", new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$InternalFrameBorder"), 778 "InternalFrame.optionDialogBorder", new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$OptionDialogBorder"), 779 "InternalFrame.paletteBorder", new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$PaletteBorder"), 780 "InternalFrame.paletteTitleHeight", new Integer (11), 781 "InternalFrame.paletteCloseIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory$PaletteCloseIcon"), 782 "InternalFrame.closeIcon", 783 new SwingLazyValue( 784 "javax.swing.plaf.metal.MetalIconFactory", 785 "getInternalFrameCloseIcon", 786 internalFrameIconArgs), 787 "InternalFrame.maximizeIcon", 788 new SwingLazyValue( 789 "javax.swing.plaf.metal.MetalIconFactory", 790 "getInternalFrameMaximizeIcon", 791 internalFrameIconArgs), 792 "InternalFrame.iconifyIcon", 793 new SwingLazyValue( 794 "javax.swing.plaf.metal.MetalIconFactory", 795 "getInternalFrameMinimizeIcon", 796 internalFrameIconArgs), 797 "InternalFrame.minimizeIcon", 798 new SwingLazyValue( 799 "javax.swing.plaf.metal.MetalIconFactory", 800 "getInternalFrameAltMaximizeIcon", 801 internalFrameIconArgs), 802 "InternalFrame.titleFont", windowTitleValue, 803 "InternalFrame.windowBindings", null, 804 "InternalFrame.closeSound", "sounds/FrameClose.wav", 806 "InternalFrame.maximizeSound", "sounds/FrameMaximize.wav", 807 "InternalFrame.minimizeSound", "sounds/FrameMinimize.wav", 808 "InternalFrame.restoreDownSound", "sounds/FrameRestoreDown.wav", 809 "InternalFrame.restoreUpSound", "sounds/FrameRestoreUp.wav", 810 811 "DesktopIcon.border", desktopIconBorder, 813 "DesktopIcon.font", controlTextValue, 814 "DesktopIcon.foreground", controlTextColor, 815 "DesktopIcon.background", control, 816 "DesktopIcon.width", new Integer (160), 817 818 "Desktop.ancestorInputMap", 819 new UIDefaults.LazyInputMap(new Object [] { 820 "ctrl F5", "restore", 821 "ctrl F4", "close", 822 "ctrl F7", "move", 823 "ctrl F8", "resize", 824 "RIGHT", "right", 825 "KP_RIGHT", "right", 826 "shift RIGHT", "shrinkRight", 827 "shift KP_RIGHT", "shrinkRight", 828 "LEFT", "left", 829 "KP_LEFT", "left", 830 "shift LEFT", "shrinkLeft", 831 "shift KP_LEFT", "shrinkLeft", 832 "UP", "up", 833 "KP_UP", "up", 834 "shift UP", "shrinkUp", 835 "shift KP_UP", "shrinkUp", 836 "DOWN", "down", 837 "KP_DOWN", "down", 838 "shift DOWN", "shrinkDown", 839 "shift KP_DOWN", "shrinkDown", 840 "ESCAPE", "escape", 841 "ctrl F9", "minimize", 842 "ctrl F10", "maximize", 843 "ctrl F6", "selectNextFrame", 844 "ctrl TAB", "selectNextFrame", 845 "ctrl alt F6", "selectNextFrame", 846 "shift ctrl alt F6", "selectPreviousFrame", 847 "ctrl F12", "navigateNext", 848 "shift ctrl F12", "navigatePrevious" 849 }), 850 851 "TitledBorder.font", controlTextValue, 853 "TitledBorder.titleColor", systemTextColor, 854 "TitledBorder.border", titledBorderBorder, 855 856 "Label.font", controlTextValue, 858 "Label.foreground", systemTextColor, 859 "Label.disabledForeground", getInactiveSystemTextColor(), 860 861 "List.font", controlTextValue, 863 "List.focusCellHighlightBorder", focusCellHighlightBorder, 864 "List.focusInputMap", 865 new UIDefaults.LazyInputMap(new Object [] { 866 "ctrl C", "copy", 867 "ctrl V", "paste", 868 "ctrl X", "cut", 869 "COPY", "copy", 870 "PASTE", "paste", 871 "CUT", "cut", 872 "UP", "selectPreviousRow", 873 "KP_UP", "selectPreviousRow", 874 "shift UP", "selectPreviousRowExtendSelection", 875 "shift KP_UP", "selectPreviousRowExtendSelection", 876 "ctrl shift UP", "selectPreviousRowExtendSelection", 877 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 878 "ctrl UP", "selectPreviousRowChangeLead", 879 "ctrl KP_UP", "selectPreviousRowChangeLead", 880 "DOWN", "selectNextRow", 881 "KP_DOWN", "selectNextRow", 882 "shift DOWN", "selectNextRowExtendSelection", 883 "shift KP_DOWN", "selectNextRowExtendSelection", 884 "ctrl shift DOWN", "selectNextRowExtendSelection", 885 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 886 "ctrl DOWN", "selectNextRowChangeLead", 887 "ctrl KP_DOWN", "selectNextRowChangeLead", 888 "LEFT", "selectPreviousColumn", 889 "KP_LEFT", "selectPreviousColumn", 890 "shift LEFT", "selectPreviousColumnExtendSelection", 891 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 892 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 893 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 894 "ctrl LEFT", "selectPreviousColumnChangeLead", 895 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 896 "RIGHT", "selectNextColumn", 897 "KP_RIGHT", "selectNextColumn", 898 "shift RIGHT", "selectNextColumnExtendSelection", 899 "shift KP_RIGHT", "selectNextColumnExtendSelection", 900 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 901 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 902 "ctrl RIGHT", "selectNextColumnChangeLead", 903 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 904 "HOME", "selectFirstRow", 905 "shift HOME", "selectFirstRowExtendSelection", 906 "ctrl shift HOME", "selectFirstRowExtendSelection", 907 "ctrl HOME", "selectFirstRowChangeLead", 908 "END", "selectLastRow", 909 "shift END", "selectLastRowExtendSelection", 910 "ctrl shift END", "selectLastRowExtendSelection", 911 "ctrl END", "selectLastRowChangeLead", 912 "PAGE_UP", "scrollUp", 913 "shift PAGE_UP", "scrollUpExtendSelection", 914 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 915 "ctrl PAGE_UP", "scrollUpChangeLead", 916 "PAGE_DOWN", "scrollDown", 917 "shift PAGE_DOWN", "scrollDownExtendSelection", 918 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 919 "ctrl PAGE_DOWN", "scrollDownChangeLead", 920 "ctrl A", "selectAll", 921 "ctrl SLASH", "selectAll", 922 "ctrl BACK_SLASH", "clearSelection", 923 "SPACE", "addToSelection", 924 "ctrl SPACE", "toggleAndAnchor", 925 "shift SPACE", "extendTo", 926 "ctrl shift SPACE", "moveSelectionTo" 927 }), 928 929 "ScrollBar.background", control, 931 "ScrollBar.highlight", controlHighlight, 932 "ScrollBar.shadow", controlShadow, 933 "ScrollBar.darkShadow", controlDarkShadow, 934 "ScrollBar.thumb", primaryControlShadow, 935 "ScrollBar.thumbShadow", primaryControlDarkShadow, 936 "ScrollBar.thumbHighlight", primaryControl, 937 "ScrollBar.width", new Integer ( 17 ), 938 "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE, 939 "ScrollBar.ancestorInputMap", 940 new UIDefaults.LazyInputMap(new Object [] { 941 "RIGHT", "positiveUnitIncrement", 942 "KP_RIGHT", "positiveUnitIncrement", 943 "DOWN", "positiveUnitIncrement", 944 "KP_DOWN", "positiveUnitIncrement", 945 "PAGE_DOWN", "positiveBlockIncrement", 946 "LEFT", "negativeUnitIncrement", 947 "KP_LEFT", "negativeUnitIncrement", 948 "UP", "negativeUnitIncrement", 949 "KP_UP", "negativeUnitIncrement", 950 "PAGE_UP", "negativeBlockIncrement", 951 "HOME", "minScroll", 952 "END", "maxScroll" 953 }), 954 955 "ScrollPane.border", scrollPaneBorder, 957 "ScrollPane.ancestorInputMap", 958 new UIDefaults.LazyInputMap(new Object [] { 959 "RIGHT", "unitScrollRight", 960 "KP_RIGHT", "unitScrollRight", 961 "DOWN", "unitScrollDown", 962 "KP_DOWN", "unitScrollDown", 963 "LEFT", "unitScrollLeft", 964 "KP_LEFT", "unitScrollLeft", 965 "UP", "unitScrollUp", 966 "KP_UP", "unitScrollUp", 967 "PAGE_UP", "scrollUp", 968 "PAGE_DOWN", "scrollDown", 969 "ctrl PAGE_UP", "scrollLeft", 970 "ctrl PAGE_DOWN", "scrollRight", 971 "ctrl HOME", "scrollHome", 972 "ctrl END", "scrollEnd" 973 }), 974 975 "TabbedPane.font", controlTextValue, 977 "TabbedPane.tabAreaBackground", control, 978 "TabbedPane.background", controlShadow, 979 "TabbedPane.light", control, 980 "TabbedPane.focus", primaryControlDarkShadow, 981 "TabbedPane.selected", control, 982 "TabbedPane.selectHighlight", controlHighlight, 983 "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets, 984 "TabbedPane.tabInsets", tabbedPaneTabInsets, 985 "TabbedPane.focusInputMap", 986 new UIDefaults.LazyInputMap(new Object [] { 987 "RIGHT", "navigateRight", 988 "KP_RIGHT", "navigateRight", 989 "LEFT", "navigateLeft", 990 "KP_LEFT", "navigateLeft", 991 "UP", "navigateUp", 992 "KP_UP", "navigateUp", 993 "DOWN", "navigateDown", 994 "KP_DOWN", "navigateDown", 995 "ctrl DOWN", "requestFocusForVisibleComponent", 996 "ctrl KP_DOWN", "requestFocusForVisibleComponent", 997 }), 998 "TabbedPane.ancestorInputMap", 999 new UIDefaults.LazyInputMap(new Object [] { 1000 "ctrl PAGE_DOWN", "navigatePageDown", 1001 "ctrl PAGE_UP", "navigatePageUp", 1002 "ctrl UP", "requestFocus", 1003 "ctrl KP_UP", "requestFocus", 1004 }), 1005 1006 "Table.font", userTextValue, 1008 "Table.focusCellHighlightBorder", focusCellHighlightBorder, 1009 "Table.scrollPaneBorder", scrollPaneBorder, 1010 "Table.gridColor", controlShadow, "Table.ancestorInputMap", 1012 new UIDefaults.LazyInputMap(new Object [] { 1013 "ctrl C", "copy", 1014 "ctrl V", "paste", 1015 "ctrl X", "cut", 1016 "COPY", "copy", 1017 "PASTE", "paste", 1018 "CUT", "cut", 1019 "RIGHT", "selectNextColumn", 1020 "KP_RIGHT", "selectNextColumn", 1021 "shift RIGHT", "selectNextColumnExtendSelection", 1022 "shift KP_RIGHT", "selectNextColumnExtendSelection", 1023 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 1024 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 1025 "ctrl RIGHT", "selectNextColumnChangeLead", 1026 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 1027 "LEFT", "selectPreviousColumn", 1028 "KP_LEFT", "selectPreviousColumn", 1029 "shift LEFT", "selectPreviousColumnExtendSelection", 1030 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 1031 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 1032 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 1033 "ctrl LEFT", "selectPreviousColumnChangeLead", 1034 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 1035 "DOWN", "selectNextRow", 1036 "KP_DOWN", "selectNextRow", 1037 "shift DOWN", "selectNextRowExtendSelection", 1038 "shift KP_DOWN", "selectNextRowExtendSelection", 1039 "ctrl shift DOWN", "selectNextRowExtendSelection", 1040 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 1041 "ctrl DOWN", "selectNextRowChangeLead", 1042 "ctrl KP_DOWN", "selectNextRowChangeLead", 1043 "UP", "selectPreviousRow", 1044 "KP_UP", "selectPreviousRow", 1045 "shift UP", "selectPreviousRowExtendSelection", 1046 "shift KP_UP", "selectPreviousRowExtendSelection", 1047 "ctrl shift UP", "selectPreviousRowExtendSelection", 1048 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 1049 "ctrl UP", "selectPreviousRowChangeLead", 1050 "ctrl KP_UP", "selectPreviousRowChangeLead", 1051 "HOME", "selectFirstColumn", 1052 "shift HOME", "selectFirstColumnExtendSelection", 1053 "ctrl shift HOME", "selectFirstRowExtendSelection", 1054 "ctrl HOME", "selectFirstRow", 1055 "END", "selectLastColumn", 1056 "shift END", "selectLastColumnExtendSelection", 1057 "ctrl shift END", "selectLastRowExtendSelection", 1058 "ctrl END", "selectLastRow", 1059 "PAGE_UP", "scrollUpChangeSelection", 1060 "shift PAGE_UP", "scrollUpExtendSelection", 1061 "ctrl shift PAGE_UP", "scrollLeftExtendSelection", 1062 "ctrl PAGE_UP", "scrollLeftChangeSelection", 1063 "PAGE_DOWN", "scrollDownChangeSelection", 1064 "shift PAGE_DOWN", "scrollDownExtendSelection", 1065 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", 1066 "ctrl PAGE_DOWN", "scrollRightChangeSelection", 1067 "TAB", "selectNextColumnCell", 1068 "shift TAB", "selectPreviousColumnCell", 1069 "ENTER", "selectNextRowCell", 1070 "shift ENTER", "selectPreviousRowCell", 1071 "ctrl A", "selectAll", 1072 "ctrl SLASH", "selectAll", 1073 "ctrl BACK_SLASH", "clearSelection", 1074 "ESCAPE", "cancel", 1075 "F2", "startEditing", 1076 "SPACE", "addToSelection", 1077 "ctrl SPACE", "toggleAndAnchor", 1078 "shift SPACE", "extendTo", 1079 "ctrl shift SPACE", "moveSelectionTo" 1080 }), 1081 1082 "TableHeader.font", userTextValue, 1083 "TableHeader.cellBorder", new SwingLazyValue( 1084 "javax.swing.plaf.metal.MetalBorders$TableHeaderBorder"), 1085 1086 "MenuBar.border", menuBarBorder, 1088 "MenuBar.font", menuTextValue, 1089 "MenuBar.windowBindings", new Object [] { 1090 "F10", "takeFocus" }, 1091 1092 "Menu.border", menuItemBorder, 1094 "Menu.borderPainted", Boolean.TRUE, 1095 "Menu.menuPopupOffsetX", zero, 1096 "Menu.menuPopupOffsetY", zero, 1097 "Menu.submenuPopupOffsetX", new Integer (-4), 1098 "Menu.submenuPopupOffsetY", new Integer (-3), 1099 "Menu.font", menuTextValue, 1100 "Menu.selectionForeground", menuSelectedForeground, 1101 "Menu.selectionBackground", menuSelectedBackground, 1102 "Menu.disabledForeground", menuDisabledForeground, 1103 "Menu.acceleratorFont", subTextValue, 1104 "Menu.acceleratorForeground", acceleratorForeground, 1105 "Menu.acceleratorSelectionForeground", acceleratorSelectedForeground, 1106 "Menu.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemCheckIcon"), 1107 "Menu.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuArrowIcon"), 1108 1109 "MenuItem.border", menuItemBorder, 1111 "MenuItem.borderPainted", Boolean.TRUE, 1112 "MenuItem.font", menuTextValue, 1113 "MenuItem.selectionForeground", menuSelectedForeground, 1114 "MenuItem.selectionBackground", menuSelectedBackground, 1115 "MenuItem.disabledForeground", menuDisabledForeground, 1116 "MenuItem.acceleratorFont", subTextValue, 1117 "MenuItem.acceleratorForeground", acceleratorForeground, 1118 "MenuItem.acceleratorSelectionForeground", acceleratorSelectedForeground, 1119 "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter, 1120 "MenuItem.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemCheckIcon"), 1121 "MenuItem.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"), 1122 "MenuItem.commandSound", "sounds/MenuItemCommand.wav", 1124 1125 "OptionPane.windowBindings", new Object [] { 1127 "ESCAPE", "close" }, 1128 "OptionPane.informationSound", "sounds/OptionPaneInformation.wav", 1130 "OptionPane.warningSound", "sounds/OptionPaneWarning.wav", 1131 "OptionPane.errorSound", "sounds/OptionPaneError.wav", 1132 "OptionPane.questionSound", "sounds/OptionPaneQuestion.wav", 1133 1134 "OptionPane.errorDialog.border.background", 1137 new ColorUIResource(153, 51, 51), 1138 "OptionPane.errorDialog.titlePane.foreground", 1139 new ColorUIResource(51, 0, 0), 1140 "OptionPane.errorDialog.titlePane.background", 1141 new ColorUIResource(255, 153, 153), 1142 "OptionPane.errorDialog.titlePane.shadow", 1143 new ColorUIResource(204, 102, 102), 1144 "OptionPane.questionDialog.border.background", 1145 new ColorUIResource(51, 102, 51), 1146 "OptionPane.questionDialog.titlePane.foreground", 1147 new ColorUIResource(0, 51, 0), 1148 "OptionPane.questionDialog.titlePane.background", 1149 new ColorUIResource(153, 204, 153), 1150 "OptionPane.questionDialog.titlePane.shadow", 1151 new ColorUIResource(102, 153, 102), 1152 "OptionPane.warningDialog.border.background", 1153 new ColorUIResource(153, 102, 51), 1154 "OptionPane.warningDialog.titlePane.foreground", 1155 new ColorUIResource(102, 51, 0), 1156 "OptionPane.warningDialog.titlePane.background", 1157 new ColorUIResource(255, 204, 153), 1158 "OptionPane.warningDialog.titlePane.shadow", 1159 new ColorUIResource(204, 153, 102), 1160 1162 "Separator.background", getSeparatorBackground(), 1164 "Separator.foreground", getSeparatorForeground(), 1165 1166 "PopupMenu.border", popupMenuBorder, 1168 "PopupMenu.popupSound", "sounds/PopupMenuPopup.wav", 1170 "PopupMenu.font", menuTextValue, 1171 1172 "CheckBoxMenuItem.border", menuItemBorder, 1174 "CheckBoxMenuItem.borderPainted", Boolean.TRUE, 1175 "CheckBoxMenuItem.font", menuTextValue, 1176 "CheckBoxMenuItem.selectionForeground", menuSelectedForeground, 1177 "CheckBoxMenuItem.selectionBackground", menuSelectedBackground, 1178 "CheckBoxMenuItem.disabledForeground", menuDisabledForeground, 1179 "CheckBoxMenuItem.acceleratorFont", subTextValue, 1180 "CheckBoxMenuItem.acceleratorForeground", acceleratorForeground, 1181 "CheckBoxMenuItem.acceleratorSelectionForeground", acceleratorSelectedForeground, 1182 "CheckBoxMenuItem.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getCheckBoxMenuItemIcon"), 1183 "CheckBoxMenuItem.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"), 1184 "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav", 1185 1186 "RadioButtonMenuItem.border", menuItemBorder, 1187 "RadioButtonMenuItem.borderPainted", Boolean.TRUE, 1188 "RadioButtonMenuItem.font", menuTextValue, 1189 "RadioButtonMenuItem.selectionForeground", menuSelectedForeground, 1190 "RadioButtonMenuItem.selectionBackground", menuSelectedBackground, 1191 "RadioButtonMenuItem.disabledForeground", menuDisabledForeground, 1192 "RadioButtonMenuItem.acceleratorFont", subTextValue, 1193 "RadioButtonMenuItem.acceleratorForeground", acceleratorForeground, 1194 "RadioButtonMenuItem.acceleratorSelectionForeground", acceleratorSelectedForeground, 1195 "RadioButtonMenuItem.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonMenuItemIcon"), 1196 "RadioButtonMenuItem.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"), 1197 "RadioButtonMenuItem.commandSound", "sounds/MenuItemCommand.wav", 1198 1199 "Spinner.ancestorInputMap", 1200 new UIDefaults.LazyInputMap(new Object [] { 1201 "UP", "increment", 1202 "KP_UP", "increment", 1203 "DOWN", "decrement", 1204 "KP_DOWN", "decrement", 1205 }), 1206 "Spinner.arrowButtonInsets", zeroInsets, 1207 "Spinner.border", textFieldBorder, 1208 "Spinner.arrowButtonBorder", buttonBorder, 1209 "Spinner.font", controlTextValue, 1210 1211 1213 "SplitPane.dividerSize", new Integer (10), 1214 "SplitPane.ancestorInputMap", 1215 new UIDefaults.LazyInputMap(new Object [] { 1216 "UP", "negativeIncrement", 1217 "DOWN", "positiveIncrement", 1218 "LEFT", "negativeIncrement", 1219 "RIGHT", "positiveIncrement", 1220 "KP_UP", "negativeIncrement", 1221 "KP_DOWN", "positiveIncrement", 1222 "KP_LEFT", "negativeIncrement", 1223 "KP_RIGHT", "positiveIncrement", 1224 "HOME", "selectMin", 1225 "END", "selectMax", 1226 "F8", "startResize", 1227 "F6", "toggleFocus", 1228 "ctrl TAB", "focusOutForward", 1229 "ctrl shift TAB", "focusOutBackward" 1230 }), 1231 "SplitPane.centerOneTouchButtons", Boolean.FALSE, 1232 "SplitPane.dividerFocusColor", primaryControl, 1233 1234 "Tree.font", userTextValue, 1237 "Tree.textBackground", getWindowBackground(), 1238 "Tree.selectionBorderColor", focusColor, 1239 "Tree.openIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"), 1240 "Tree.closedIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"), 1241 "Tree.leafIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeLeafIcon"), 1242 "Tree.expandedIcon", new SwingLazyValue( 1243 "javax.swing.plaf.metal.MetalIconFactory", 1244 "getTreeControlIcon", 1245 new Object [] {Boolean.valueOf(MetalIconFactory.DARK)}), 1246 "Tree.collapsedIcon", new SwingLazyValue( 1247 "javax.swing.plaf.metal.MetalIconFactory", 1248 "getTreeControlIcon", 1249 new Object [] {Boolean.valueOf( MetalIconFactory.LIGHT )}), 1250 1251 "Tree.line", primaryControl, "Tree.hash", primaryControl, "Tree.rowHeight", zero, 1254 "Tree.focusInputMap", 1255 new UIDefaults.LazyInputMap(new Object [] { 1256 "ADD", "expand", 1257 "SUBTRACT", "collapse", 1258 "ctrl C", "copy", 1259 "ctrl V", "paste", 1260 "ctrl X", "cut", 1261 "COPY", "copy", 1262 "PASTE", "paste", 1263 "CUT", "cut", 1264 "UP", "selectPrevious", 1265 "KP_UP", "selectPrevious", 1266 "shift UP", "selectPreviousExtendSelection", 1267 "shift KP_UP", "selectPreviousExtendSelection", 1268 "ctrl shift UP", "selectPreviousExtendSelection", 1269 "ctrl shift KP_UP", "selectPreviousExtendSelection", 1270 "ctrl UP", "selectPreviousChangeLead", 1271 "ctrl KP_UP", "selectPreviousChangeLead", 1272 "DOWN", "selectNext", 1273 "KP_DOWN", "selectNext", 1274 "shift DOWN", "selectNextExtendSelection", 1275 "shift KP_DOWN", "selectNextExtendSelection", 1276 "ctrl shift DOWN", "selectNextExtendSelection", 1277 "ctrl shift KP_DOWN", "selectNextExtendSelection", 1278 "ctrl DOWN", "selectNextChangeLead", 1279 "ctrl KP_DOWN", "selectNextChangeLead", 1280 "RIGHT", "selectChild", 1281 "KP_RIGHT", "selectChild", 1282 "LEFT", "selectParent", 1283 "KP_LEFT", "selectParent", 1284 "PAGE_UP", "scrollUpChangeSelection", 1285 "shift PAGE_UP", "scrollUpExtendSelection", 1286 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 1287 "ctrl PAGE_UP", "scrollUpChangeLead", 1288 "PAGE_DOWN", "scrollDownChangeSelection", 1289 "shift PAGE_DOWN", "scrollDownExtendSelection", 1290 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 1291 "ctrl PAGE_DOWN", "scrollDownChangeLead", 1292 "HOME", "selectFirst", 1293 "shift HOME", "selectFirstExtendSelection", 1294 "ctrl shift HOME", "selectFirstExtendSelection", 1295 "ctrl HOME", "selectFirstChangeLead", 1296 "END", "selectLast", 1297 "shift END", "selectLastExtendSelection", 1298 "ctrl shift END", "selectLastExtendSelection", 1299 "ctrl END", "selectLastChangeLead", 1300 "F2", "startEditing", 1301 "ctrl A", "selectAll", 1302 "ctrl SLASH", "selectAll", 1303 "ctrl BACK_SLASH", "clearSelection", 1304 "ctrl LEFT", "scrollLeft", 1305 "ctrl KP_LEFT", "scrollLeft", 1306 "ctrl RIGHT", "scrollRight", 1307 "ctrl KP_RIGHT", "scrollRight", 1308 "SPACE", "addToSelection", 1309 "ctrl SPACE", "toggleAndAnchor", 1310 "shift SPACE", "extendTo", 1311 "ctrl shift SPACE", "moveSelectionTo" 1312 }), 1313 "Tree.ancestorInputMap", 1314 new UIDefaults.LazyInputMap(new Object [] { 1315 "ESCAPE", "cancel" 1316 }), 1317 1318 "ToolBar.border", toolBarBorder, 1320 "ToolBar.background", menuBackground, 1321 "ToolBar.foreground", getMenuForeground(), 1322 "ToolBar.font", menuTextValue, 1323 "ToolBar.dockingBackground", menuBackground, 1324 "ToolBar.floatingBackground", menuBackground, 1325 "ToolBar.dockingForeground", primaryControlDarkShadow, 1326 "ToolBar.floatingForeground", primaryControl, 1327 "ToolBar.rolloverBorder", new MetalLazyValue( 1328 "javax.swing.plaf.metal.MetalBorders", 1329 "getToolBarRolloverBorder"), 1330 "ToolBar.nonrolloverBorder", new MetalLazyValue( 1331 "javax.swing.plaf.metal.MetalBorders", 1332 "getToolBarNonrolloverBorder"), 1333 "ToolBar.ancestorInputMap", 1334 new UIDefaults.LazyInputMap(new Object [] { 1335 "UP", "navigateUp", 1336 "KP_UP", "navigateUp", 1337 "DOWN", "navigateDown", 1338 "KP_DOWN", "navigateDown", 1339 "LEFT", "navigateLeft", 1340 "KP_LEFT", "navigateLeft", 1341 "RIGHT", "navigateRight", 1342 "KP_RIGHT", "navigateRight" 1343 }), 1344 1345 "RootPane.frameBorder", new MetalLazyValue( 1347 "javax.swing.plaf.metal.MetalBorders$FrameBorder"), 1348 "RootPane.plainDialogBorder", dialogBorder, 1349 "RootPane.informationDialogBorder", dialogBorder, 1350 "RootPane.errorDialogBorder", new MetalLazyValue( 1351 "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder"), 1352 "RootPane.colorChooserDialogBorder", questionDialogBorder, 1353 "RootPane.fileChooserDialogBorder", questionDialogBorder, 1354 "RootPane.questionDialogBorder", questionDialogBorder, 1355 "RootPane.warningDialogBorder", new MetalLazyValue( 1356 "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder"), 1357 "RootPane.defaultButtonWindowKeyBindings", new Object [] { 1360 "ENTER", "press", 1361 "released ENTER", "release", 1362 "ctrl ENTER", "press", 1363 "ctrl released ENTER", "release" 1364 }, 1365 }; 1366 1367 table.putDefaults(defaults); 1368 1369 if (isWindows() && useSystemFonts() && theme.isSystemTheme()) { 1370 Toolkit kit = Toolkit.getDefaultToolkit(); 1371 Object messageFont = new MetalFontDesktopProperty ( 1372 "win.messagebox.font.height", kit, MetalTheme. 1373 CONTROL_TEXT_FONT); 1374 1375 defaults = new Object [] { 1376 "OptionPane.messageFont", messageFont, 1377 "OptionPane.buttonFont", messageFont, 1378 }; 1379 table.putDefaults(defaults); 1380 } 1381 } 1382 1383 protected void createDefaultTheme() { 1384 getCurrentTheme(); 1385 } 1386 1387 public UIDefaults getDefaults() { 1388 METAL_LOOK_AND_FEEL_INITED = true; 1390 1391 createDefaultTheme(); 1392 UIDefaults table = super.getDefaults(); 1393 currentTheme.addCustomEntriesToTable(table); 1394 currentTheme.install(); 1395 return table; 1396 } 1397 1398 1419 public void provideErrorFeedback(Component component) { 1420 super.provideErrorFeedback(component); 1421 } 1422 1423 1446 public static void setCurrentTheme(MetalTheme theme) { 1447 if (theme == null) { 1451 throw new NullPointerException ("Can't have null theme"); 1452 } 1453 currentTheme = theme; 1454 cachedAppContext = AppContext.getAppContext(); 1455 cachedAppContext.put( "currentMetalTheme", theme ); 1456 } 1457 1458 1467 public static MetalTheme getCurrentTheme() { 1468 AppContext context = AppContext.getAppContext(); 1469 1470 if ( cachedAppContext != context ) { 1471 currentTheme = (MetalTheme )context.get( "currentMetalTheme" ); 1472 if (currentTheme == null) { 1473 if (useHighContrastTheme()) { 1481 currentTheme = new MetalHighContrastTheme (); 1482 } 1483 else { 1484 String theme = (String )AccessController.doPrivileged( 1487 new GetPropertyAction("swing.metalTheme")); 1488 if ("steel".equals(theme)) { 1489 currentTheme = new DefaultMetalTheme (); 1490 } 1491 else { 1492 currentTheme = new OceanTheme (); 1493 } 1494 } 1495 setCurrentTheme(currentTheme); 1496 } 1497 cachedAppContext = context; 1498 } 1499 1500 return currentTheme; 1501 } 1502 1503 1521 public Icon getDisabledIcon(JComponent component, Icon icon) { 1522 if ((icon instanceof ImageIcon) && MetalLookAndFeel.usingOcean()) { 1523 return MetalUtils.getOceanDisabledButtonIcon( 1524 ((ImageIcon)icon).getImage()); 1525 } 1526 return super.getDisabledIcon(component, icon); 1527 } 1528 1529 1549 public Icon getDisabledSelectedIcon(JComponent component, Icon icon) { 1550 if ((icon instanceof ImageIcon) && MetalLookAndFeel.usingOcean()) { 1551 return MetalUtils.getOceanDisabledButtonIcon( 1552 ((ImageIcon)icon).getImage()); 1553 } 1554 return super.getDisabledSelectedIcon(component, icon); 1555 } 1556 1557 public static FontUIResource getControlTextFont() { return getCurrentTheme().getControlTextFont();} 1558 public static FontUIResource getSystemTextFont() { return getCurrentTheme().getSystemTextFont();} 1559 public static FontUIResource getUserTextFont() { return getCurrentTheme().getUserTextFont();} 1560 public static FontUIResource getMenuTextFont() { return getCurrentTheme().getMenuTextFont();} 1561 public static FontUIResource getWindowTitleFont() { return getCurrentTheme().getWindowTitleFont();} 1562 public static FontUIResource getSubTextFont() { return getCurrentTheme().getSubTextFont();} 1563 1564 public static ColorUIResource getDesktopColor() { return getCurrentTheme().getDesktopColor(); } 1565 public static ColorUIResource getFocusColor() { return getCurrentTheme().getFocusColor(); } 1566 1567 public static ColorUIResource getWhite() { return getCurrentTheme().getWhite(); } 1568 public static ColorUIResource getBlack() { return getCurrentTheme().getBlack(); } 1569 public static ColorUIResource getControl() { return getCurrentTheme().getControl(); } 1570 public static ColorUIResource getControlShadow() { return getCurrentTheme().getControlShadow(); } 1571 public static ColorUIResource getControlDarkShadow() { return getCurrentTheme().getControlDarkShadow(); } 1572 public static ColorUIResource getControlInfo() { return getCurrentTheme().getControlInfo(); } 1573 public static ColorUIResource getControlHighlight() { return getCurrentTheme().getControlHighlight(); } 1574 public static ColorUIResource getControlDisabled() { return getCurrentTheme().getControlDisabled(); } 1575 1576 public static ColorUIResource getPrimaryControl() { return getCurrentTheme().getPrimaryControl(); } 1577 public static ColorUIResource getPrimaryControlShadow() { return getCurrentTheme().getPrimaryControlShadow(); } 1578 public static ColorUIResource getPrimaryControlDarkShadow() { return getCurrentTheme().getPrimaryControlDarkShadow(); } 1579 public static ColorUIResource getPrimaryControlInfo() { return getCurrentTheme().getPrimaryControlInfo(); } 1580 public static ColorUIResource getPrimaryControlHighlight() { return getCurrentTheme().getPrimaryControlHighlight(); } 1581 1582 public static ColorUIResource getSystemTextColor() { return getCurrentTheme().getSystemTextColor(); } 1583 public static ColorUIResource getControlTextColor() { return getCurrentTheme().getControlTextColor(); } 1584 public static ColorUIResource getInactiveControlTextColor() { return getCurrentTheme().getInactiveControlTextColor(); } 1585 public static ColorUIResource getInactiveSystemTextColor() { return getCurrentTheme().getInactiveSystemTextColor(); } 1586 public static ColorUIResource getUserTextColor() { return getCurrentTheme().getUserTextColor(); } 1587 public static ColorUIResource getTextHighlightColor() { return getCurrentTheme().getTextHighlightColor(); } 1588 public static ColorUIResource getHighlightedTextColor() { return getCurrentTheme().getHighlightedTextColor(); } 1589 1590 public static ColorUIResource getWindowBackground() { return getCurrentTheme().getWindowBackground(); } 1591 public static ColorUIResource getWindowTitleBackground() { return getCurrentTheme().getWindowTitleBackground(); } 1592 public static ColorUIResource getWindowTitleForeground() { return getCurrentTheme().getWindowTitleForeground(); } 1593 public static ColorUIResource getWindowTitleInactiveBackground() { return getCurrentTheme().getWindowTitleInactiveBackground(); } 1594 public static ColorUIResource getWindowTitleInactiveForeground() { return getCurrentTheme().getWindowTitleInactiveForeground(); } 1595 1596 public static ColorUIResource getMenuBackground() { return getCurrentTheme().getMenuBackground(); } 1597 public static ColorUIResource getMenuForeground() { return getCurrentTheme().getMenuForeground(); } 1598 public static ColorUIResource getMenuSelectedBackground() { return getCurrentTheme().getMenuSelectedBackground(); } 1599 public static ColorUIResource getMenuSelectedForeground() { return getCurrentTheme().getMenuSelectedForeground(); } 1600 public static ColorUIResource getMenuDisabledForeground() { return getCurrentTheme().getMenuDisabledForeground(); } 1601 public static ColorUIResource getSeparatorBackground() { return getCurrentTheme().getSeparatorBackground(); } 1602 public static ColorUIResource getSeparatorForeground() { return getCurrentTheme().getSeparatorForeground(); } 1603 public static ColorUIResource getAcceleratorForeground() { return getCurrentTheme().getAcceleratorForeground(); } 1604 public static ColorUIResource getAcceleratorSelectedForeground() { return getCurrentTheme().getAcceleratorSelectedForeground(); } 1605 1606 1607 1612 private static class MetalLazyValue implements UIDefaults.LazyValue { 1613 1616 private String className; 1617 private String methodName; 1618 1619 MetalLazyValue(String name) { 1620 this.className = name; 1621 } 1622 1623 MetalLazyValue(String name, String methodName) { 1624 this(name); 1625 this.methodName = methodName; 1626 } 1627 1628 public Object createValue(UIDefaults table) { 1629 try { 1630 final Class c = Class.forName(className); 1631 1632 if (methodName == null) { 1633 return c.newInstance(); 1634 } 1635 Method method = (Method)AccessController.doPrivileged( 1636 new PrivilegedAction () { 1637 public Object run() { 1638 Method[] methods = c.getDeclaredMethods(); 1639 for (int counter = methods.length - 1; counter >= 0; 1640 counter--) { 1641 if (methods[counter].getName().equals(methodName)){ 1642 methods[counter].setAccessible(true); 1643 return methods[counter]; 1644 } 1645 } 1646 return null; 1647 } 1648 }); 1649 if (method != null) { 1650 return method.invoke(null, null); 1651 } 1652 } catch (ClassNotFoundException cnfe) { 1653 } catch (InstantiationException ie) { 1654 } catch (IllegalAccessException iae) { 1655 } catch (InvocationTargetException ite) { 1656 } 1657 return null; 1658 } 1659 } 1660 1661 1662 1665 private static class FontActiveValue implements UIDefaults.ActiveValue { 1666 private int type; 1667 private MetalTheme theme; 1668 1669 FontActiveValue(MetalTheme theme, int type) { 1670 this.theme = theme; 1671 this.type = type; 1672 } 1673 1674 public Object createValue(UIDefaults table) { 1675 Object value = null; 1676 switch (type) { 1677 case MetalTheme.CONTROL_TEXT_FONT: 1678 value = theme.getControlTextFont(); 1679 break; 1680 case MetalTheme.SYSTEM_TEXT_FONT: 1681 value = theme.getSystemTextFont(); 1682 break; 1683 case MetalTheme.USER_TEXT_FONT: 1684 value = theme.getUserTextFont(); 1685 break; 1686 case MetalTheme.MENU_TEXT_FONT: 1687 value = theme.getMenuTextFont(); 1688 break; 1689 case MetalTheme.WINDOW_TITLE_FONT: 1690 value = theme.getWindowTitleFont(); 1691 break; 1692 case MetalTheme.SUB_TEXT_FONT: 1693 value = theme.getSubTextFont(); 1694 break; 1695 } 1696 return value; 1697 } 1698 } 1699} 1700 | Popular Tags |