1 7 8 package javax.swing.plaf.basic; 9 10 import java.awt.Font ; 11 import java.awt.Color ; 12 import java.awt.SystemColor ; 13 import java.awt.event.*; 14 import java.awt.Insets ; 15 import java.awt.Component ; 16 import java.awt.Container ; 17 import java.awt.FocusTraversalPolicy ; 18 import java.awt.AWTEvent ; 19 import java.awt.Toolkit ; 20 import java.awt.Point ; 21 import java.net.URL ; 22 import java.io.*; 23 import java.awt.Dimension ; 24 import java.awt.KeyboardFocusManager ; 25 import java.security.AccessController ; 26 import java.security.PrivilegedAction ; 27 import java.util.*; 28 import java.lang.reflect.*; 29 import javax.sound.sampled.*; 30 31 import sun.awt.AppContext; 32 33 import sun.swing.SwingLazyValue; 34 import com.sun.java.swing.SwingUtilities2; 35 36 import javax.swing.LookAndFeel ; 37 import javax.swing.AbstractAction ; 38 import javax.swing.Action ; 39 import javax.swing.ActionMap ; 40 import javax.swing.BorderFactory ; 41 import javax.swing.JComponent ; 42 import javax.swing.ImageIcon ; 43 import javax.swing.UIDefaults ; 44 import javax.swing.UIManager ; 45 import javax.swing.KeyStroke ; 46 import javax.swing.JTextField ; 47 import javax.swing.DefaultListCellRenderer ; 48 import javax.swing.FocusManager ; 49 import javax.swing.LayoutFocusTraversalPolicy ; 50 import javax.swing.SwingUtilities ; 51 import javax.swing.MenuSelectionManager ; 52 import javax.swing.MenuElement ; 53 import javax.swing.border.*; 54 import javax.swing.plaf.*; 55 import javax.swing.text.JTextComponent ; 56 import javax.swing.text.DefaultEditorKit ; 57 import java.beans.PropertyChangeListener ; 58 import java.beans.PropertyChangeEvent ; 59 60 61 79 public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable 80 { 81 84 static boolean hasPopups; 85 86 89 private Object audioLock = new Object (); 90 93 private Clip clipPlaying; 94 95 PopupInvocationHelper invocator = null; 96 97 100 private PropertyChangeListener disposer = null; 101 102 public UIDefaults getDefaults() { 103 UIDefaults table = new UIDefaults (); 104 105 initClassDefaults(table); 106 initSystemColorDefaults(table); 107 initComponentDefaults(table); 108 109 return table; 110 } 111 112 116 public void initialize() { 117 if (hasPopups) { 118 createdPopup(); 119 } 120 } 121 122 126 public void uninitialize() { 127 Toolkit tk = Toolkit.getDefaultToolkit(); 128 if(invocator != null) { 129 AccessController.doPrivileged(invocator); 130 invocator = null; 131 } 132 133 if (disposer != null) { 134 AppContext.getAppContext().removePropertyChangeListener( 139 AppContext.GUI_DISPOSED, 140 disposer); 141 disposer = null; 142 } 143 } 144 145 154 protected void initClassDefaults(UIDefaults table) 155 { 156 final String basicPackageName = "javax.swing.plaf.basic."; 157 Object [] uiDefaults = { 158 "ButtonUI", basicPackageName + "BasicButtonUI", 159 "CheckBoxUI", basicPackageName + "BasicCheckBoxUI", 160 "ColorChooserUI", basicPackageName + "BasicColorChooserUI", 161 "FormattedTextFieldUI", basicPackageName + "BasicFormattedTextFieldUI", 162 "MenuBarUI", basicPackageName + "BasicMenuBarUI", 163 "MenuUI", basicPackageName + "BasicMenuUI", 164 "MenuItemUI", basicPackageName + "BasicMenuItemUI", 165 "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI", 166 "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI", 167 "RadioButtonUI", basicPackageName + "BasicRadioButtonUI", 168 "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI", 169 "PopupMenuUI", basicPackageName + "BasicPopupMenuUI", 170 "ProgressBarUI", basicPackageName + "BasicProgressBarUI", 171 "ScrollBarUI", basicPackageName + "BasicScrollBarUI", 172 "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI", 173 "SplitPaneUI", basicPackageName + "BasicSplitPaneUI", 174 "SliderUI", basicPackageName + "BasicSliderUI", 175 "SeparatorUI", basicPackageName + "BasicSeparatorUI", 176 "SpinnerUI", basicPackageName + "BasicSpinnerUI", 177 "ToolBarSeparatorUI", basicPackageName + "BasicToolBarSeparatorUI", 178 "PopupMenuSeparatorUI", basicPackageName + "BasicPopupMenuSeparatorUI", 179 "TabbedPaneUI", basicPackageName + "BasicTabbedPaneUI", 180 "TextAreaUI", basicPackageName + "BasicTextAreaUI", 181 "TextFieldUI", basicPackageName + "BasicTextFieldUI", 182 "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI", 183 "TextPaneUI", basicPackageName + "BasicTextPaneUI", 184 "EditorPaneUI", basicPackageName + "BasicEditorPaneUI", 185 "TreeUI", basicPackageName + "BasicTreeUI", 186 "LabelUI", basicPackageName + "BasicLabelUI", 187 "ListUI", basicPackageName + "BasicListUI", 188 "ToolBarUI", basicPackageName + "BasicToolBarUI", 189 "ToolTipUI", basicPackageName + "BasicToolTipUI", 190 "ComboBoxUI", basicPackageName + "BasicComboBoxUI", 191 "TableUI", basicPackageName + "BasicTableUI", 192 "TableHeaderUI", basicPackageName + "BasicTableHeaderUI", 193 "InternalFrameUI", basicPackageName + "BasicInternalFrameUI", 194 "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI", 195 "DesktopIconUI", basicPackageName + "BasicDesktopIconUI", 196 "OptionPaneUI", basicPackageName + "BasicOptionPaneUI", 197 "PanelUI", basicPackageName + "BasicPanelUI", 198 "ViewportUI", basicPackageName + "BasicViewportUI", 199 "RootPaneUI", basicPackageName + "BasicRootPaneUI", 200 }; 201 202 table.putDefaults(uiDefaults); 203 } 204 205 213 protected void initSystemColorDefaults(UIDefaults table) 214 { 215 String [] defaultSystemColors = { 216 "desktop", "#005C5C", 217 "activeCaption", "#000080", 218 "activeCaptionText", "#FFFFFF", 219 "activeCaptionBorder", "#C0C0C0", 220 "inactiveCaption", "#808080", 221 "inactiveCaptionText", "#C0C0C0", 222 "inactiveCaptionBorder", "#C0C0C0", 223 "window", "#FFFFFF", 224 "windowBorder", "#000000", 225 "windowText", "#000000", 226 "menu", "#C0C0C0", 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 "controlLtHighlight", "#FFFFFF", 237 "controlShadow", "#808080", 238 "controlDkShadow", "#000000", 239 "scrollbar", "#E0E0E0", 240 "info", "#FFFFE1", 241 "infoText", "#000000" 242 }; 243 244 loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel()); 245 } 246 247 248 254 protected void loadSystemColors(UIDefaults table, String [] systemColors, boolean useNative) 255 { 256 260 if (useNative) { 261 for(int i = 0; i < systemColors.length; i += 2) { 262 Color color = Color.black; 263 try { 264 String name = systemColors[i]; 265 color = (Color )(SystemColor .class.getField(name).get(null)); 266 } catch (Exception e) { 267 } 268 table.put(systemColors[i], new ColorUIResource(color)); 269 } 270 } else { 271 for(int i = 0; i < systemColors.length; i += 2) { 272 Color color = Color.black; 273 try { 274 color = Color.decode(systemColors[i + 1]); 275 } 276 catch(NumberFormatException e) { 277 e.printStackTrace(); 278 } 279 table.put(systemColors[i], new ColorUIResource(color)); 280 } 281 } 282 } 283 290 private void initResourceBundle(UIDefaults table) { 291 table.setDefaultLocale( Locale.getDefault() ); 292 table.addResourceBundle( "com.sun.swing.internal.plaf.basic.resources.basic" ); 293 } 294 295 protected void initComponentDefaults(UIDefaults table) 296 { 297 298 initResourceBundle(table); 299 300 Integer fiveHundred = new Integer (500); 302 303 Long oneThousand = new Long (1000); 305 306 Integer twelve = new Integer (12); 308 Integer fontPlain = new Integer (Font.PLAIN); 309 Integer fontBold = new Integer (Font.BOLD); 310 Object dialogPlain12 = new SwingLazyValue( 311 "javax.swing.plaf.FontUIResource", 312 null, 313 new Object [] {"Dialog", fontPlain, twelve}); 314 Object serifPlain12 = new SwingLazyValue( 315 "javax.swing.plaf.FontUIResource", 316 null, 317 new Object [] {"Serif", fontPlain, twelve}); 318 Object sansSerifPlain12 = new SwingLazyValue( 319 "javax.swing.plaf.FontUIResource", 320 null, 321 new Object [] {"SansSerif", fontPlain, twelve}); 322 Object monospacedPlain12 = new SwingLazyValue( 323 "javax.swing.plaf.FontUIResource", 324 null, 325 new Object [] {"MonoSpaced", fontPlain, twelve}); 326 Object dialogBold12 = new SwingLazyValue( 327 "javax.swing.plaf.FontUIResource", 328 null, 329 new Object [] {"Dialog", fontBold, twelve}); 330 331 332 ColorUIResource red = new ColorUIResource(Color.red); 334 ColorUIResource black = new ColorUIResource(Color.black); 335 ColorUIResource white = new ColorUIResource(Color.white); 336 ColorUIResource yellow = new ColorUIResource(Color.yellow); 337 ColorUIResource gray = new ColorUIResource(Color.gray); 338 ColorUIResource lightGray = new ColorUIResource(Color.lightGray); 339 ColorUIResource darkGray = new ColorUIResource(Color.darkGray); 340 ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224); 341 342 Color control = table.getColor("control"); 343 Color controlDkShadow = table.getColor("controlDkShadow"); 344 Color controlHighlight = table.getColor("controlHighlight"); 345 Color controlLtHighlight = table.getColor("controlLtHighlight"); 346 Color controlShadow = table.getColor("controlShadow"); 347 Color controlText = table.getColor("controlText"); 348 Color menu = table.getColor("menu"); 349 Color menuText = table.getColor("menuText"); 350 Color textHighlight = table.getColor("textHighlight"); 351 Color textHighlightText = table.getColor("textHighlightText"); 352 Color textInactiveText = table.getColor("textInactiveText"); 353 Color textText = table.getColor("textText"); 354 Color window = table.getColor("window"); 355 356 InsetsUIResource zeroInsets = new InsetsUIResource(0,0,0,0); 358 InsetsUIResource twoInsets = new InsetsUIResource(2, 2, 2, 2); 359 360 Object marginBorder = new SwingLazyValue( 362 "javax.swing.plaf.basic.BasicBorders$MarginBorder"); 363 Object etchedBorder = new SwingLazyValue( 364 "javax.swing.plaf.BorderUIResource", 365 "getEtchedBorderUIResource"); 366 Object loweredBevelBorder = new SwingLazyValue( 367 "javax.swing.plaf.BorderUIResource", 368 "getLoweredBevelBorderUIResource"); 369 370 Object popupMenuBorder = new SwingLazyValue( 371 "javax.swing.plaf.basic.BasicBorders", 372 "getInternalFrameBorder"); 373 374 Object blackLineBorder = new SwingLazyValue( 375 "javax.swing.plaf.BorderUIResource", 376 "getBlackLineBorderUIResource"); 377 Object focusCellHighlightBorder = new SwingLazyValue( 378 "javax.swing.plaf.BorderUIResource$LineBorderUIResource", 379 null, 380 new Object [] {yellow}); 381 382 383 Object tableHeaderBorder = new SwingLazyValue( 384 "javax.swing.plaf.BorderUIResource$BevelBorderUIResource", 385 null, 386 new Object [] { new Integer (BevelBorder.RAISED), 387 controlLtHighlight, 388 control, 389 controlDkShadow, 390 controlShadow }); 391 392 393 395 Object buttonBorder = 396 new SwingLazyValue( 397 "javax.swing.plaf.basic.BasicBorders", 398 "getButtonBorder"); 399 400 Object buttonToggleBorder = 401 new SwingLazyValue( 402 "javax.swing.plaf.basic.BasicBorders", 403 "getToggleButtonBorder"); 404 405 Object radioButtonBorder = 406 new SwingLazyValue( 407 "javax.swing.plaf.basic.BasicBorders", 408 "getRadioButtonBorder"); 409 410 412 Object newFolderIcon = SwingUtilities2.makeIcon(getClass(), 413 BasicLookAndFeel .class, 414 "icons/NewFolder.gif"); 415 Object upFolderIcon = SwingUtilities2.makeIcon(getClass(), 416 BasicLookAndFeel .class, 417 "icons/UpFolder.gif"); 418 Object homeFolderIcon = SwingUtilities2.makeIcon(getClass(), 419 BasicLookAndFeel .class, 420 "icons/HomeFolder.gif"); 421 Object detailsViewIcon = SwingUtilities2.makeIcon(getClass(), 422 BasicLookAndFeel .class, 423 "icons/DetailsView.gif"); 424 Object listViewIcon = SwingUtilities2.makeIcon(getClass(), 425 BasicLookAndFeel .class, 426 "icons/ListView.gif"); 427 Object directoryIcon = SwingUtilities2.makeIcon(getClass(), 428 BasicLookAndFeel .class, 429 "icons/Directory.gif"); 430 Object fileIcon = SwingUtilities2.makeIcon(getClass(), 431 BasicLookAndFeel .class, 432 "icons/File.gif"); 433 Object computerIcon = SwingUtilities2.makeIcon(getClass(), 434 BasicLookAndFeel .class, 435 "icons/Computer.gif"); 436 Object hardDriveIcon = SwingUtilities2.makeIcon(getClass(), 437 BasicLookAndFeel .class, 438 "icons/HardDrive.gif"); 439 Object floppyDriveIcon = SwingUtilities2.makeIcon(getClass(), 440 BasicLookAndFeel .class, 441 "icons/FloppyDrive.gif"); 442 443 444 446 Object internalFrameBorder = new SwingLazyValue( 447 "javax.swing.plaf.basic.BasicBorders", 448 "getInternalFrameBorder"); 449 450 452 Object listCellRendererActiveValue = new UIDefaults.ActiveValue () { 453 public Object createValue(UIDefaults table) { 454 return new DefaultListCellRenderer.UIResource (); 455 } 456 }; 457 458 459 461 Object menuBarBorder = 462 new SwingLazyValue( 463 "javax.swing.plaf.basic.BasicBorders", 464 "getMenuBarBorder"); 465 466 Object menuItemCheckIcon = 467 new SwingLazyValue( 468 "javax.swing.plaf.basic.BasicIconFactory", 469 "getMenuItemCheckIcon"); 470 471 Object menuItemArrowIcon = 472 new SwingLazyValue( 473 "javax.swing.plaf.basic.BasicIconFactory", 474 "getMenuItemArrowIcon"); 475 476 477 Object menuArrowIcon = 478 new SwingLazyValue( 479 "javax.swing.plaf.basic.BasicIconFactory", 480 "getMenuArrowIcon"); 481 482 Object checkBoxIcon = 483 new SwingLazyValue( 484 "javax.swing.plaf.basic.BasicIconFactory", 485 "getCheckBoxIcon"); 486 487 Object radioButtonIcon = 488 new SwingLazyValue( 489 "javax.swing.plaf.basic.BasicIconFactory", 490 "getRadioButtonIcon"); 491 492 Object checkBoxMenuItemIcon = 493 new SwingLazyValue( 494 "javax.swing.plaf.basic.BasicIconFactory", 495 "getCheckBoxMenuItemIcon"); 496 497 Object radioButtonMenuItemIcon = 498 new SwingLazyValue( 499 "javax.swing.plaf.basic.BasicIconFactory", 500 "getRadioButtonMenuItemIcon"); 501 502 Object menuItemAcceleratorDelimiter = new String ("+"); 503 504 506 Object optionPaneMinimumSize = new DimensionUIResource(262, 90); 507 508 Integer zero = new Integer (0); 509 Object zeroBorder = new SwingLazyValue( 510 "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource", 511 new Object [] {zero, zero, zero, zero}); 512 513 Integer ten = new Integer (10); 514 Object optionPaneBorder = new SwingLazyValue( 515 "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource", 516 new Object [] {ten, ten, twelve, ten}); 517 518 Object optionPaneButtonAreaBorder = new SwingLazyValue( 519 "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource", 520 new Object [] {new Integer (6), zero, zero, zero}); 521 522 523 525 Object progressBarBorder = 526 new SwingLazyValue( 527 "javax.swing.plaf.basic.BasicBorders", 528 "getProgressBarBorder"); 529 530 532 Object minimumThumbSize = new DimensionUIResource(8,8); 533 Object maximumThumbSize = new DimensionUIResource(4096,4096); 534 535 537 Object sliderFocusInsets = twoInsets; 538 539 Object toolBarSeparatorSize = new DimensionUIResource( 10, 10 ); 540 541 542 544 Object splitPaneBorder = 545 new SwingLazyValue( 546 "javax.swing.plaf.basic.BasicBorders", 547 "getSplitPaneBorder"); 548 Object splitPaneDividerBorder = 549 new SwingLazyValue( 550 "javax.swing.plaf.basic.BasicBorders", 551 "getSplitPaneDividerBorder"); 552 553 555 Object tabbedPaneTabInsets = new InsetsUIResource(0, 4, 1, 4); 556 557 Object tabbedPaneTabPadInsets = new InsetsUIResource(2, 2, 2, 1); 558 559 Object tabbedPaneTabAreaInsets = new InsetsUIResource(3, 2, 0, 2); 560 561 Object tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 3, 3); 562 563 564 566 Object textFieldBorder = 567 new SwingLazyValue( 568 "javax.swing.plaf.basic.BasicBorders", 569 "getTextFieldBorder"); 570 571 Object editorMargin = new InsetsUIResource(3,3,3,3); 572 573 Object caretBlinkRate = fiveHundred; 574 Integer four = new Integer (4); 575 576 Object [] allAuditoryCues = new Object [] { 577 "CheckBoxMenuItem.commandSound", 578 "InternalFrame.closeSound", 579 "InternalFrame.maximizeSound", 580 "InternalFrame.minimizeSound", 581 "InternalFrame.restoreDownSound", 582 "InternalFrame.restoreUpSound", 583 "MenuItem.commandSound", 584 "OptionPane.errorSound", 585 "OptionPane.informationSound", 586 "OptionPane.questionSound", 587 "OptionPane.warningSound", 588 "PopupMenu.popupSound", 589 "RadioButtonMenuItem.commandSound"}; 590 591 Object [] noAuditoryCues = new Object [] {"mute"}; 592 593 595 Object [] defaults = { 596 "AuditoryCues.cueList", allAuditoryCues, 598 "AuditoryCues.allAuditoryCues", allAuditoryCues, 599 "AuditoryCues.noAuditoryCues", noAuditoryCues, 600 "AuditoryCues.playList", null, 603 604 "Button.defaultButtonFollowsFocus", Boolean.TRUE, 606 "Button.font", dialogPlain12, 607 "Button.background", control, 608 "Button.foreground", controlText, 609 "Button.shadow", controlShadow, 610 "Button.darkShadow", controlDkShadow, 611 "Button.light", controlHighlight, 612 "Button.highlight", controlLtHighlight, 613 "Button.border", buttonBorder, 614 "Button.margin", new InsetsUIResource(2, 14, 2, 14), 615 "Button.textIconGap", four, 616 "Button.textShiftOffset", zero, 617 "Button.focusInputMap", new UIDefaults.LazyInputMap (new Object [] { 618 "SPACE", "pressed", 619 "released SPACE", "released", 620 "ENTER", "pressed", 621 "released ENTER", "released" 622 }), 623 624 "ToggleButton.font", dialogPlain12, 625 "ToggleButton.background", control, 626 "ToggleButton.foreground", controlText, 627 "ToggleButton.shadow", controlShadow, 628 "ToggleButton.darkShadow", controlDkShadow, 629 "ToggleButton.light", controlHighlight, 630 "ToggleButton.highlight", controlLtHighlight, 631 "ToggleButton.border", buttonToggleBorder, 632 "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), 633 "ToggleButton.textIconGap", four, 634 "ToggleButton.textShiftOffset", zero, 635 "ToggleButton.focusInputMap", 636 new UIDefaults.LazyInputMap (new Object [] { 637 "SPACE", "pressed", 638 "released SPACE", "released" 639 }), 640 641 "RadioButton.font", dialogPlain12, 642 "RadioButton.background", control, 643 "RadioButton.foreground", controlText, 644 "RadioButton.shadow", controlShadow, 645 "RadioButton.darkShadow", controlDkShadow, 646 "RadioButton.light", controlHighlight, 647 "RadioButton.highlight", controlLtHighlight, 648 "RadioButton.border", radioButtonBorder, 649 "RadioButton.margin", twoInsets, 650 "RadioButton.textIconGap", four, 651 "RadioButton.textShiftOffset", zero, 652 "RadioButton.icon", radioButtonIcon, 653 "RadioButton.focusInputMap", 654 new UIDefaults.LazyInputMap (new Object [] { 655 "SPACE", "pressed", 656 "released SPACE", "released", 657 "RETURN", "pressed" 658 }), 659 660 "CheckBox.font", dialogPlain12, 661 "CheckBox.background", control, 662 "CheckBox.foreground", controlText, 663 "CheckBox.border", radioButtonBorder, 664 "CheckBox.margin", twoInsets, 665 "CheckBox.textIconGap", four, 666 "CheckBox.textShiftOffset", zero, 667 "CheckBox.icon", checkBoxIcon, 668 "CheckBox.focusInputMap", 669 new UIDefaults.LazyInputMap (new Object [] { 670 "SPACE", "pressed", 671 "released SPACE", "released" 672 }), 673 "FileChooser.useSystemExtensionHiding", Boolean.FALSE, 674 675 "ColorChooser.font", dialogPlain12, 677 "ColorChooser.background", control, 678 "ColorChooser.foreground", controlText, 679 680 "ColorChooser.swatchesSwatchSize", new Dimension (10, 10), 681 "ColorChooser.swatchesRecentSwatchSize", new Dimension (10, 10), 682 "ColorChooser.swatchesDefaultRecentColor", control, 683 684 "ComboBox.font", sansSerifPlain12, 686 "ComboBox.background", window, 687 "ComboBox.foreground", textText, 688 "ComboBox.buttonBackground", control, 689 "ComboBox.buttonShadow", controlShadow, 690 "ComboBox.buttonDarkShadow", controlDkShadow, 691 "ComboBox.buttonHighlight", controlLtHighlight, 692 "ComboBox.selectionBackground", textHighlight, 693 "ComboBox.selectionForeground", textHighlightText, 694 "ComboBox.disabledBackground", control, 695 "ComboBox.disabledForeground", textInactiveText, 696 "ComboBox.timeFactor", oneThousand, 697 "ComboBox.ancestorInputMap", 698 new UIDefaults.LazyInputMap (new Object [] { 699 "ESCAPE", "hidePopup", 700 "PAGE_UP", "pageUpPassThrough", 701 "PAGE_DOWN", "pageDownPassThrough", 702 "HOME", "homePassThrough", 703 "END", "endPassThrough", 704 "ENTER", "enterPressed" 705 }), 706 707 709 "FileChooser.newFolderIcon", newFolderIcon, 710 "FileChooser.upFolderIcon", upFolderIcon, 711 "FileChooser.homeFolderIcon", homeFolderIcon, 712 "FileChooser.detailsViewIcon", detailsViewIcon, 713 "FileChooser.listViewIcon", listViewIcon, 714 "FileChooser.readOnly", Boolean.FALSE, 715 "FileChooser.usesSingleFilePane", Boolean.FALSE, 716 "FileChooser.ancestorInputMap", 717 new UIDefaults.LazyInputMap (new Object [] { 718 "ESCAPE", "cancelSelection", 719 "F5", "refresh", 720 }), 721 722 "FileView.directoryIcon", directoryIcon, 723 "FileView.fileIcon", fileIcon, 724 "FileView.computerIcon", computerIcon, 725 "FileView.hardDriveIcon", hardDriveIcon, 726 "FileView.floppyDriveIcon", floppyDriveIcon, 727 728 "InternalFrame.titleFont", dialogBold12, 730 "InternalFrame.borderColor", control, 731 "InternalFrame.borderShadow", controlShadow, 732 "InternalFrame.borderDarkShadow", controlDkShadow, 733 "InternalFrame.borderHighlight", controlLtHighlight, 734 "InternalFrame.borderLight", controlHighlight, 735 "InternalFrame.border", internalFrameBorder, 736 "InternalFrame.icon", SwingUtilities2.makeIcon(getClass(), 737 BasicLookAndFeel .class, 738 "icons/JavaCup16.png"), 739 740 741 "InternalFrame.maximizeIcon", 742 new SwingLazyValue( 743 "javax.swing.plaf.basic.BasicIconFactory", 744 "createEmptyFrameIcon"), 745 "InternalFrame.minimizeIcon", 746 new SwingLazyValue( 747 "javax.swing.plaf.basic.BasicIconFactory", 748 "createEmptyFrameIcon"), 749 "InternalFrame.iconifyIcon", 750 new SwingLazyValue( 751 "javax.swing.plaf.basic.BasicIconFactory", 752 "createEmptyFrameIcon"), 753 "InternalFrame.closeIcon", 754 new SwingLazyValue( 755 "javax.swing.plaf.basic.BasicIconFactory", 756 "createEmptyFrameIcon"), 757 "InternalFrame.closeSound", null, 759 "InternalFrame.maximizeSound", null, 760 "InternalFrame.minimizeSound", null, 761 "InternalFrame.restoreDownSound", null, 762 "InternalFrame.restoreUpSound", null, 763 764 "InternalFrame.activeTitleBackground", table.get("activeCaption"), 765 "InternalFrame.activeTitleForeground", table.get("activeCaptionText"), 766 "InternalFrame.inactiveTitleBackground", table.get("inactiveCaption"), 767 "InternalFrame.inactiveTitleForeground", table.get("inactiveCaptionText"), 768 "InternalFrame.windowBindings", new Object [] { 769 "shift ESCAPE", "showSystemMenu", 770 "ctrl SPACE", "showSystemMenu", 771 "ESCAPE", "hideSystemMenu"}, 772 773 "DesktopIcon.border", internalFrameBorder, 774 775 "Desktop.background", table.get("desktop"), 776 "Desktop.ancestorInputMap", 777 new UIDefaults.LazyInputMap (new Object [] { 778 "ctrl F5", "restore", 779 "ctrl F4", "close", 780 "ctrl F7", "move", 781 "ctrl F8", "resize", 782 "RIGHT", "right", 783 "KP_RIGHT", "right", 784 "shift RIGHT", "shrinkRight", 785 "shift KP_RIGHT", "shrinkRight", 786 "LEFT", "left", 787 "KP_LEFT", "left", 788 "shift LEFT", "shrinkLeft", 789 "shift KP_LEFT", "shrinkLeft", 790 "UP", "up", 791 "KP_UP", "up", 792 "shift UP", "shrinkUp", 793 "shift KP_UP", "shrinkUp", 794 "DOWN", "down", 795 "KP_DOWN", "down", 796 "shift DOWN", "shrinkDown", 797 "shift KP_DOWN", "shrinkDown", 798 "ESCAPE", "escape", 799 "ctrl F9", "minimize", 800 "ctrl F10", "maximize", 801 "ctrl F6", "selectNextFrame", 802 "ctrl TAB", "selectNextFrame", 803 "ctrl alt F6", "selectNextFrame", 804 "shift ctrl alt F6", "selectPreviousFrame", 805 "ctrl F12", "navigateNext", 806 "shift ctrl F12", "navigatePrevious" 807 }), 808 809 "Label.font", dialogPlain12, 811 "Label.background", control, 812 "Label.foreground", controlText, 813 "Label.disabledForeground", white, 814 "Label.disabledShadow", controlShadow, 815 "Label.border", null, 816 817 "List.font", dialogPlain12, 819 "List.background", window, 820 "List.foreground", textText, 821 "List.selectionBackground", textHighlight, 822 "List.selectionForeground", textHighlightText, 823 "List.focusCellHighlightBorder", focusCellHighlightBorder, 824 "List.border", null, 825 "List.cellRenderer", listCellRendererActiveValue, 826 "List.timeFactor", oneThousand, 827 "List.focusInputMap", 828 new UIDefaults.LazyInputMap (new Object [] { 829 "ctrl C", "copy", 830 "ctrl V", "paste", 831 "ctrl X", "cut", 832 "COPY", "copy", 833 "PASTE", "paste", 834 "CUT", "cut", 835 "UP", "selectPreviousRow", 836 "KP_UP", "selectPreviousRow", 837 "shift UP", "selectPreviousRowExtendSelection", 838 "shift KP_UP", "selectPreviousRowExtendSelection", 839 "ctrl shift UP", "selectPreviousRowExtendSelection", 840 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 841 "ctrl UP", "selectPreviousRowChangeLead", 842 "ctrl KP_UP", "selectPreviousRowChangeLead", 843 "DOWN", "selectNextRow", 844 "KP_DOWN", "selectNextRow", 845 "shift DOWN", "selectNextRowExtendSelection", 846 "shift KP_DOWN", "selectNextRowExtendSelection", 847 "ctrl shift DOWN", "selectNextRowExtendSelection", 848 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 849 "ctrl DOWN", "selectNextRowChangeLead", 850 "ctrl KP_DOWN", "selectNextRowChangeLead", 851 "LEFT", "selectPreviousColumn", 852 "KP_LEFT", "selectPreviousColumn", 853 "shift LEFT", "selectPreviousColumnExtendSelection", 854 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 855 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 856 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 857 "ctrl LEFT", "selectPreviousColumnChangeLead", 858 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 859 "RIGHT", "selectNextColumn", 860 "KP_RIGHT", "selectNextColumn", 861 "shift RIGHT", "selectNextColumnExtendSelection", 862 "shift KP_RIGHT", "selectNextColumnExtendSelection", 863 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 864 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 865 "ctrl RIGHT", "selectNextColumnChangeLead", 866 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 867 "HOME", "selectFirstRow", 868 "shift HOME", "selectFirstRowExtendSelection", 869 "ctrl shift HOME", "selectFirstRowExtendSelection", 870 "ctrl HOME", "selectFirstRowChangeLead", 871 "END", "selectLastRow", 872 "shift END", "selectLastRowExtendSelection", 873 "ctrl shift END", "selectLastRowExtendSelection", 874 "ctrl END", "selectLastRowChangeLead", 875 "PAGE_UP", "scrollUp", 876 "shift PAGE_UP", "scrollUpExtendSelection", 877 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 878 "ctrl PAGE_UP", "scrollUpChangeLead", 879 "PAGE_DOWN", "scrollDown", 880 "shift PAGE_DOWN", "scrollDownExtendSelection", 881 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 882 "ctrl PAGE_DOWN", "scrollDownChangeLead", 883 "ctrl A", "selectAll", 884 "ctrl SLASH", "selectAll", 885 "ctrl BACK_SLASH", "clearSelection", 886 "SPACE", "addToSelection", 887 "ctrl SPACE", "toggleAndAnchor", 888 "shift SPACE", "extendTo", 889 "ctrl shift SPACE", "moveSelectionTo" 890 }), 891 "List.focusInputMap.RightToLeft", 892 new UIDefaults.LazyInputMap (new Object [] { 893 "LEFT", "selectNextColumn", 894 "KP_LEFT", "selectNextColumn", 895 "shift LEFT", "selectNextColumnExtendSelection", 896 "shift KP_LEFT", "selectNextColumnExtendSelection", 897 "ctrl shift LEFT", "selectNextColumnExtendSelection", 898 "ctrl shift KP_LEFT", "selectNextColumnExtendSelection", 899 "ctrl LEFT", "selectNextColumnChangeLead", 900 "ctrl KP_LEFT", "selectNextColumnChangeLead", 901 "RIGHT", "selectPreviousColumn", 902 "KP_RIGHT", "selectPreviousColumn", 903 "shift RIGHT", "selectPreviousColumnExtendSelection", 904 "shift KP_RIGHT", "selectPreviousColumnExtendSelection", 905 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection", 906 "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection", 907 "ctrl RIGHT", "selectPreviousColumnChangeLead", 908 "ctrl KP_RIGHT", "selectPreviousColumnChangeLead", 909 }), 910 911 "MenuBar.font", dialogPlain12, 913 "MenuBar.background", menu, 914 "MenuBar.foreground", menuText, 915 "MenuBar.shadow", controlShadow, 916 "MenuBar.highlight", controlLtHighlight, 917 "MenuBar.border", menuBarBorder, 918 "MenuBar.windowBindings", new Object [] { 919 "F10", "takeFocus" }, 920 921 "MenuItem.font", dialogPlain12, 922 "MenuItem.acceleratorFont", dialogPlain12, 923 "MenuItem.background", menu, 924 "MenuItem.foreground", menuText, 925 "MenuItem.selectionForeground", textHighlightText, 926 "MenuItem.selectionBackground", textHighlight, 927 "MenuItem.disabledForeground", null, 928 "MenuItem.acceleratorForeground", menuText, 929 "MenuItem.acceleratorSelectionForeground", textHighlightText, 930 "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter, 931 "MenuItem.border", marginBorder, 932 "MenuItem.borderPainted", Boolean.FALSE, 933 "MenuItem.margin", twoInsets, 934 "MenuItem.checkIcon", menuItemCheckIcon, 935 "MenuItem.arrowIcon", menuItemArrowIcon, 936 "MenuItem.commandSound", null, 937 938 "RadioButtonMenuItem.font", dialogPlain12, 939 "RadioButtonMenuItem.acceleratorFont", dialogPlain12, 940 "RadioButtonMenuItem.background", menu, 941 "RadioButtonMenuItem.foreground", menuText, 942 "RadioButtonMenuItem.selectionForeground", textHighlightText, 943 "RadioButtonMenuItem.selectionBackground", textHighlight, 944 "RadioButtonMenuItem.disabledForeground", null, 945 "RadioButtonMenuItem.acceleratorForeground", menuText, 946 "RadioButtonMenuItem.acceleratorSelectionForeground", textHighlightText, 947 "RadioButtonMenuItem.border", marginBorder, 948 "RadioButtonMenuItem.borderPainted", Boolean.FALSE, 949 "RadioButtonMenuItem.margin", twoInsets, 950 "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon, 951 "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon, 952 "RadioButtonMenuItem.commandSound", null, 953 954 "CheckBoxMenuItem.font", dialogPlain12, 955 "CheckBoxMenuItem.acceleratorFont", dialogPlain12, 956 "CheckBoxMenuItem.background", menu, 957 "CheckBoxMenuItem.foreground", menuText, 958 "CheckBoxMenuItem.selectionForeground", textHighlightText, 959 "CheckBoxMenuItem.selectionBackground", textHighlight, 960 "CheckBoxMenuItem.disabledForeground", null, 961 "CheckBoxMenuItem.acceleratorForeground", menuText, 962 "CheckBoxMenuItem.acceleratorSelectionForeground", textHighlightText, 963 "CheckBoxMenuItem.border", marginBorder, 964 "CheckBoxMenuItem.borderPainted", Boolean.FALSE, 965 "CheckBoxMenuItem.margin", twoInsets, 966 "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon, 967 "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon, 968 "CheckBoxMenuItem.commandSound", null, 969 970 "Menu.font", dialogPlain12, 971 "Menu.acceleratorFont", dialogPlain12, 972 "Menu.background", menu, 973 "Menu.foreground", menuText, 974 "Menu.selectionForeground", textHighlightText, 975 "Menu.selectionBackground", textHighlight, 976 "Menu.disabledForeground", null, 977 "Menu.acceleratorForeground", menuText, 978 "Menu.acceleratorSelectionForeground", textHighlightText, 979 "Menu.border", marginBorder, 980 "Menu.borderPainted", Boolean.FALSE, 981 "Menu.margin", twoInsets, 982 "Menu.checkIcon", menuItemCheckIcon, 983 "Menu.arrowIcon", menuArrowIcon, 984 "Menu.menuPopupOffsetX", new Integer (0), 985 "Menu.menuPopupOffsetY", new Integer (0), 986 "Menu.submenuPopupOffsetX", new Integer (0), 987 "Menu.submenuPopupOffsetY", new Integer (0), 988 "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK}, 989 "Menu.crossMenuMnemonic", Boolean.TRUE, 990 991 "PopupMenu.font", dialogPlain12, 993 "PopupMenu.background", menu, 994 "PopupMenu.foreground", menuText, 995 "PopupMenu.border", popupMenuBorder, 996 "PopupMenu.popupSound", null, 998 "PopupMenu.selectedWindowInputMapBindings", new Object [] { 1001 "ESCAPE", "cancel", 1002 "DOWN", "selectNext", 1003 "KP_DOWN", "selectNext", 1004 "UP", "selectPrevious", 1005 "KP_UP", "selectPrevious", 1006 "LEFT", "selectParent", 1007 "KP_LEFT", "selectParent", 1008 "RIGHT", "selectChild", 1009 "KP_RIGHT", "selectChild", 1010 "ENTER", "return", 1011 "SPACE", "return" 1012 }, 1013 "PopupMenu.selectedWindowInputMapBindings.RightToLeft", new Object [] { 1014 "LEFT", "selectChild", 1015 "KP_LEFT", "selectChild", 1016 "RIGHT", "selectParent", 1017 "KP_RIGHT", "selectParent", 1018 }, 1019 "PopupMenu.consumeEventOnClose", Boolean.FALSE, 1020 1021 "OptionPane.font", dialogPlain12, 1026 "OptionPane.background", control, 1027 "OptionPane.foreground", controlText, 1028 "OptionPane.messageForeground", controlText, 1029 "OptionPane.border", optionPaneBorder, 1030 "OptionPane.messageAreaBorder", zeroBorder, 1031 "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder, 1032 "OptionPane.minimumSize", optionPaneMinimumSize, 1033 "OptionPane.errorIcon", SwingUtilities2.makeIcon(getClass(), 1034 BasicLookAndFeel .class, 1035 "icons/Error.gif"), 1036 "OptionPane.informationIcon", SwingUtilities2.makeIcon(getClass(), 1037 BasicLookAndFeel .class, 1038 "icons/Inform.gif"), 1039 "OptionPane.warningIcon", SwingUtilities2.makeIcon(getClass(), 1040 BasicLookAndFeel .class, 1041 "icons/Warn.gif"), 1042 "OptionPane.questionIcon", SwingUtilities2.makeIcon(getClass(), 1043 BasicLookAndFeel .class, 1044 "icons/Question.gif"), 1045 "OptionPane.windowBindings", new Object [] { 1046 "ESCAPE", "close" }, 1047 "OptionPane.errorSound", null, 1049 "OptionPane.informationSound", null, "OptionPane.questionSound", null, 1051 "OptionPane.warningSound", null, 1052 "OptionPane.buttonClickThreshhold", fiveHundred, 1053 1054 "Panel.font", dialogPlain12, 1056 "Panel.background", control, 1057 "Panel.foreground", textText, 1058 1059 "ProgressBar.font", dialogPlain12, 1061 "ProgressBar.foreground", textHighlight, 1062 "ProgressBar.background", control, 1063 "ProgressBar.selectionForeground", control, 1064 "ProgressBar.selectionBackground", textHighlight, 1065 "ProgressBar.border", progressBarBorder, 1066 "ProgressBar.cellLength", new Integer (1), 1067 "ProgressBar.cellSpacing", zero, 1068 "ProgressBar.repaintInterval", new Integer (50), 1069 "ProgressBar.cycleTime", new Integer (3000), 1070 "ProgressBar.horizontalSize", new DimensionUIResource(146, 12), 1071 "ProgressBar.verticalSize", new DimensionUIResource(12, 146), 1072 1073 "Separator.shadow", controlShadow, "Separator.highlight", controlLtHighlight, 1077 "Separator.background", controlLtHighlight, 1078 "Separator.foreground", controlShadow, 1079 1080 "ScrollBar.background", scrollBarTrack, 1082 "ScrollBar.foreground", control, 1083 "ScrollBar.track", table.get("scrollbar"), 1084 "ScrollBar.trackHighlight", controlDkShadow, 1085 "ScrollBar.thumb", control, 1086 "ScrollBar.thumbHighlight", controlLtHighlight, 1087 "ScrollBar.thumbDarkShadow", controlDkShadow, 1088 "ScrollBar.thumbShadow", controlShadow, 1089 "ScrollBar.border", null, 1090 "ScrollBar.minimumThumbSize", minimumThumbSize, 1091 "ScrollBar.maximumThumbSize", maximumThumbSize, 1092 "ScrollBar.ancestorInputMap", 1093 new UIDefaults.LazyInputMap (new Object [] { 1094 "RIGHT", "positiveUnitIncrement", 1095 "KP_RIGHT", "positiveUnitIncrement", 1096 "DOWN", "positiveUnitIncrement", 1097 "KP_DOWN", "positiveUnitIncrement", 1098 "PAGE_DOWN", "positiveBlockIncrement", 1099 "LEFT", "negativeUnitIncrement", 1100 "KP_LEFT", "negativeUnitIncrement", 1101 "UP", "negativeUnitIncrement", 1102 "KP_UP", "negativeUnitIncrement", 1103 "PAGE_UP", "negativeBlockIncrement", 1104 "HOME", "minScroll", 1105 "END", "maxScroll" 1106 }), 1107 "ScrollBar.ancestorInputMap.RightToLeft", 1108 new UIDefaults.LazyInputMap (new Object [] { 1109 "RIGHT", "negativeUnitIncrement", 1110 "KP_RIGHT", "negativeUnitIncrement", 1111 "LEFT", "positiveUnitIncrement", 1112 "KP_LEFT", "positiveUnitIncrement", 1113 }), 1114 "ScrollBar.width", new Integer (16), 1115 1116 "ScrollPane.font", dialogPlain12, 1117 "ScrollPane.background", control, 1118 "ScrollPane.foreground", controlText, 1119 "ScrollPane.border", textFieldBorder, 1120 "ScrollPane.viewportBorder", null, 1121 "ScrollPane.ancestorInputMap", 1122 new UIDefaults.LazyInputMap (new Object [] { 1123 "RIGHT", "unitScrollRight", 1124 "KP_RIGHT", "unitScrollRight", 1125 "DOWN", "unitScrollDown", 1126 "KP_DOWN", "unitScrollDown", 1127 "LEFT", "unitScrollLeft", 1128 "KP_LEFT", "unitScrollLeft", 1129 "UP", "unitScrollUp", 1130 "KP_UP", "unitScrollUp", 1131 "PAGE_UP", "scrollUp", 1132 "PAGE_DOWN", "scrollDown", 1133 "ctrl PAGE_UP", "scrollLeft", 1134 "ctrl PAGE_DOWN", "scrollRight", 1135 "ctrl HOME", "scrollHome", 1136 "ctrl END", "scrollEnd" 1137 }), 1138 "ScrollPane.ancestorInputMap.RightToLeft", 1139 new UIDefaults.LazyInputMap (new Object [] { 1140 "ctrl PAGE_UP", "scrollRight", 1141 "ctrl PAGE_DOWN", "scrollLeft", 1142 }), 1143 1144 "Viewport.font", dialogPlain12, 1145 "Viewport.background", control, 1146 "Viewport.foreground", textText, 1147 1148 "Slider.foreground", control, 1150 "Slider.background", control, 1151 "Slider.highlight", controlLtHighlight, 1152 "Slider.tickColor", Color.black, 1153 "Slider.shadow", controlShadow, 1154 "Slider.focus", controlDkShadow, 1155 "Slider.border", null, 1156 "Slider.horizontalSize", new Dimension (200, 21), 1157 "Slider.verticalSize", new Dimension (21, 200), 1158 "Slider.minimumHorizontalSize", new Dimension (36, 21), 1159 "Slider.minimumVerticalSize", new Dimension (21, 36), 1160 "Slider.focusInsets", sliderFocusInsets, 1161 "Slider.focusInputMap", 1162 new UIDefaults.LazyInputMap (new Object [] { 1163 "RIGHT", "positiveUnitIncrement", 1164 "KP_RIGHT", "positiveUnitIncrement", 1165 "DOWN", "negativeUnitIncrement", 1166 "KP_DOWN", "negativeUnitIncrement", 1167 "PAGE_DOWN", "negativeBlockIncrement", 1168 "LEFT", "negativeUnitIncrement", 1169 "KP_LEFT", "negativeUnitIncrement", 1170 "UP", "positiveUnitIncrement", 1171 "KP_UP", "positiveUnitIncrement", 1172 "PAGE_UP", "positiveBlockIncrement", 1173 "HOME", "minScroll", 1174 "END", "maxScroll" 1175 }), 1176 "Slider.focusInputMap.RightToLeft", 1177 new UIDefaults.LazyInputMap (new Object [] { 1178 "RIGHT", "negativeUnitIncrement", 1179 "KP_RIGHT", "negativeUnitIncrement", 1180 "LEFT", "positiveUnitIncrement", 1181 "KP_LEFT", "positiveUnitIncrement", 1182 }), 1183 1184 "Spinner.font", monospacedPlain12, 1186 "Spinner.background", control, 1187 "Spinner.foreground", control, 1188 "Spinner.border", textFieldBorder, 1189 "Spinner.arrowButtonBorder", null, 1190 "Spinner.arrowButtonInsets", null, 1191 "Spinner.arrowButtonSize", new Dimension (16, 5), 1192 "Spinner.ancestorInputMap", 1193 new UIDefaults.LazyInputMap (new Object [] { 1194 "UP", "increment", 1195 "KP_UP", "increment", 1196 "DOWN", "decrement", 1197 "KP_DOWN", "decrement", 1198 }), 1199 "Spinner.editorBorderPainted", Boolean.FALSE, 1200 1201 "SplitPane.background", control, 1203 "SplitPane.highlight", controlLtHighlight, 1204 "SplitPane.shadow", controlShadow, 1205 "SplitPane.darkShadow", controlDkShadow, 1206 "SplitPane.border", splitPaneBorder, 1207 "SplitPane.dividerSize", new Integer (7), 1208 "SplitPaneDivider.border", splitPaneDividerBorder, 1209 "SplitPaneDivider.draggingColor", darkGray, 1210 "SplitPane.ancestorInputMap", 1211 new UIDefaults.LazyInputMap (new Object [] { 1212 "UP", "negativeIncrement", 1213 "DOWN", "positiveIncrement", 1214 "LEFT", "negativeIncrement", 1215 "RIGHT", "positiveIncrement", 1216 "KP_UP", "negativeIncrement", 1217 "KP_DOWN", "positiveIncrement", 1218 "KP_LEFT", "negativeIncrement", 1219 "KP_RIGHT", "positiveIncrement", 1220 "HOME", "selectMin", 1221 "END", "selectMax", 1222 "F8", "startResize", 1223 "F6", "toggleFocus", 1224 "ctrl TAB", "focusOutForward", 1225 "ctrl shift TAB", "focusOutBackward" 1226 }), 1227 1228 "TabbedPane.font", dialogPlain12, 1230 "TabbedPane.background", control, 1231 "TabbedPane.foreground", controlText, 1232 "TabbedPane.highlight", controlLtHighlight, 1233 "TabbedPane.light", controlHighlight, 1234 "TabbedPane.shadow", controlShadow, 1235 "TabbedPane.darkShadow", controlDkShadow, 1236 "TabbedPane.selected", null, 1237 "TabbedPane.focus", controlText, 1238 "TabbedPane.textIconGap", four, 1239 1240 "TabbedPane.tabsOverlapBorder", Boolean.FALSE, 1244 1245 "TabbedPane.tabInsets", tabbedPaneTabInsets, 1246 "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets, 1247 "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets, 1248 "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets, 1249 "TabbedPane.tabRunOverlay", new Integer (2), 1250 "TabbedPane.tabsOpaque", Boolean.TRUE, 1251 "TabbedPane.contentOpaque", Boolean.TRUE, 1252 "TabbedPane.focusInputMap", 1253 new UIDefaults.LazyInputMap (new Object [] { 1254 "RIGHT", "navigateRight", 1255 "KP_RIGHT", "navigateRight", 1256 "LEFT", "navigateLeft", 1257 "KP_LEFT", "navigateLeft", 1258 "UP", "navigateUp", 1259 "KP_UP", "navigateUp", 1260 "DOWN", "navigateDown", 1261 "KP_DOWN", "navigateDown", 1262 "ctrl DOWN", "requestFocusForVisibleComponent", 1263 "ctrl KP_DOWN", "requestFocusForVisibleComponent", 1264 }), 1265 "TabbedPane.ancestorInputMap", 1266 new UIDefaults.LazyInputMap (new Object [] { 1267 "ctrl PAGE_DOWN", "navigatePageDown", 1268 "ctrl PAGE_UP", "navigatePageUp", 1269 "ctrl UP", "requestFocus", 1270 "ctrl KP_UP", "requestFocus", 1271 }), 1272 1273 1274 "Table.font", dialogPlain12, 1276 "Table.foreground", controlText, "Table.background", window, "Table.selectionForeground", textHighlightText, 1279 "Table.selectionBackground", textHighlight, 1280 "Table.gridColor", gray, "Table.focusCellBackground", window, 1282 "Table.focusCellForeground", controlText, 1283 "Table.focusCellHighlightBorder", focusCellHighlightBorder, 1284 "Table.scrollPaneBorder", loweredBevelBorder, 1285 "Table.ancestorInputMap", 1286 new UIDefaults.LazyInputMap (new Object [] { 1287 "ctrl C", "copy", 1288 "ctrl V", "paste", 1289 "ctrl X", "cut", 1290 "COPY", "copy", 1291 "PASTE", "paste", 1292 "CUT", "cut", 1293 "RIGHT", "selectNextColumn", 1294 "KP_RIGHT", "selectNextColumn", 1295 "shift RIGHT", "selectNextColumnExtendSelection", 1296 "shift KP_RIGHT", "selectNextColumnExtendSelection", 1297 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 1298 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 1299 "ctrl RIGHT", "selectNextColumnChangeLead", 1300 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 1301 "LEFT", "selectPreviousColumn", 1302 "KP_LEFT", "selectPreviousColumn", 1303 "shift LEFT", "selectPreviousColumnExtendSelection", 1304 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 1305 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 1306 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 1307 "ctrl LEFT", "selectPreviousColumnChangeLead", 1308 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 1309 "DOWN", "selectNextRow", 1310 "KP_DOWN", "selectNextRow", 1311 "shift DOWN", "selectNextRowExtendSelection", 1312 "shift KP_DOWN", "selectNextRowExtendSelection", 1313 "ctrl shift DOWN", "selectNextRowExtendSelection", 1314 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 1315 "ctrl DOWN", "selectNextRowChangeLead", 1316 "ctrl KP_DOWN", "selectNextRowChangeLead", 1317 "UP", "selectPreviousRow", 1318 "KP_UP", "selectPreviousRow", 1319 "shift UP", "selectPreviousRowExtendSelection", 1320 "shift KP_UP", "selectPreviousRowExtendSelection", 1321 "ctrl shift UP", "selectPreviousRowExtendSelection", 1322 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 1323 "ctrl UP", "selectPreviousRowChangeLead", 1324 "ctrl KP_UP", "selectPreviousRowChangeLead", 1325 "HOME", "selectFirstColumn", 1326 "shift HOME", "selectFirstColumnExtendSelection", 1327 "ctrl shift HOME", "selectFirstRowExtendSelection", 1328 "ctrl HOME", "selectFirstRow", 1329 "END", "selectLastColumn", 1330 "shift END", "selectLastColumnExtendSelection", 1331 "ctrl shift END", "selectLastRowExtendSelection", 1332 "ctrl END", "selectLastRow", 1333 "PAGE_UP", "scrollUpChangeSelection", 1334 "shift PAGE_UP", "scrollUpExtendSelection", 1335 "ctrl shift PAGE_UP", "scrollLeftExtendSelection", 1336 "ctrl PAGE_UP", "scrollLeftChangeSelection", 1337 "PAGE_DOWN", "scrollDownChangeSelection", 1338 "shift PAGE_DOWN", "scrollDownExtendSelection", 1339 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", 1340 "ctrl PAGE_DOWN", "scrollRightChangeSelection", 1341 "TAB", "selectNextColumnCell", 1342 "shift TAB", "selectPreviousColumnCell", 1343 "ENTER", "selectNextRowCell", 1344 "shift ENTER", "selectPreviousRowCell", 1345 "ctrl A", "selectAll", 1346 "ctrl SLASH", "selectAll", 1347 "ctrl BACK_SLASH", "clearSelection", 1348 "ESCAPE", "cancel", 1349 "F2", "startEditing", 1350 "SPACE", "addToSelection", 1351 "ctrl SPACE", "toggleAndAnchor", 1352 "shift SPACE", "extendTo", 1353 "ctrl shift SPACE", "moveSelectionTo" 1354 }), 1355 "Table.ancestorInputMap.RightToLeft", 1356 new UIDefaults.LazyInputMap (new Object [] { 1357 "RIGHT", "selectPreviousColumn", 1358 "KP_RIGHT", "selectPreviousColumn", 1359 "shift RIGHT", "selectPreviousColumnExtendSelection", 1360 "shift KP_RIGHT", "selectPreviousColumnExtendSelection", 1361 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection", 1362 "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection", 1363 "shift RIGHT", "selectPreviousColumnChangeLead", 1364 "shift KP_RIGHT", "selectPreviousColumnChangeLead", 1365 "LEFT", "selectNextColumn", 1366 "KP_LEFT", "selectNextColumn", 1367 "shift LEFT", "selectNextColumnExtendSelection", 1368 "shift KP_LEFT", "selectNextColumnExtendSelection", 1369 "ctrl shift LEFT", "selectNextColumnExtendSelection", 1370 "ctrl shift KP_LEFT", "selectNextColumnExtendSelection", 1371 "ctrl LEFT", "selectNextColumnChangeLead", 1372 "ctrl KP_LEFT", "selectNextColumnChangeLead", 1373 "ctrl PAGE_UP", "scrollRightChangeSelection", 1374 "ctrl PAGE_DOWN", "scrollLeftChangeSelection", 1375 "ctrl shift PAGE_UP", "scrollRightExtendSelection", 1376 "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", 1377 }), 1378 1379 "TableHeader.font", dialogPlain12, 1380 "TableHeader.foreground", controlText, "TableHeader.background", control, "TableHeader.cellBorder", tableHeaderBorder, 1383 1384 "TextField.font", sansSerifPlain12, 1386 "TextField.background", window, 1387 "TextField.foreground", textText, 1388 "TextField.shadow", controlShadow, 1389 "TextField.darkShadow", controlDkShadow, 1390 "TextField.light", controlHighlight, 1391 "TextField.highlight", controlLtHighlight, 1392 "TextField.inactiveForeground", textInactiveText, 1393 "TextField.inactiveBackground", control, 1394 "TextField.selectionBackground", textHighlight, 1395 "TextField.selectionForeground", textHighlightText, 1396 "TextField.caretForeground", textText, 1397 "TextField.caretBlinkRate", caretBlinkRate, 1398 "TextField.border", textFieldBorder, 1399 "TextField.margin", zeroInsets, 1400 1401 "FormattedTextField.font", sansSerifPlain12, 1402 "FormattedTextField.background", window, 1403 "FormattedTextField.foreground", textText, 1404 "FormattedTextField.inactiveForeground", textInactiveText, 1405 "FormattedTextField.inactiveBackground", control, 1406 "FormattedTextField.selectionBackground", textHighlight, 1407 "FormattedTextField.selectionForeground", textHighlightText, 1408 "FormattedTextField.caretForeground", textText, 1409 "FormattedTextField.caretBlinkRate", caretBlinkRate, 1410 "FormattedTextField.border", textFieldBorder, 1411 "FormattedTextField.margin", zeroInsets, 1412 "FormattedTextField.focusInputMap", 1413 new UIDefaults.LazyInputMap (new Object [] { 1414 "ctrl C", DefaultEditorKit.copyAction, 1415 "ctrl V", DefaultEditorKit.pasteAction, 1416 "ctrl X", DefaultEditorKit.cutAction, 1417 "COPY", DefaultEditorKit.copyAction, 1418 "PASTE", DefaultEditorKit.pasteAction, 1419 "CUT", DefaultEditorKit.cutAction, 1420 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 1421 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 1422 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 1423 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 1424 "ctrl LEFT", DefaultEditorKit.previousWordAction, 1425 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 1426 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 1427 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 1428 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 1429 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 1430 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 1431 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 1432 "ctrl A", DefaultEditorKit.selectAllAction, 1433 "HOME", DefaultEditorKit.beginLineAction, 1434 "END", DefaultEditorKit.endLineAction, 1435 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 1436 "shift END", DefaultEditorKit.selectionEndLineAction, 1437 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 1438 "ctrl H", DefaultEditorKit.deletePrevCharAction, 1439 "DELETE", DefaultEditorKit.deleteNextCharAction, 1440 "RIGHT", DefaultEditorKit.forwardAction, 1441 "LEFT", DefaultEditorKit.backwardAction, 1442 "KP_RIGHT", DefaultEditorKit.forwardAction, 1443 "KP_LEFT", DefaultEditorKit.backwardAction, 1444 "ENTER", JTextField.notifyAction, 1445 "ctrl BACK_SLASH", "unselect", 1446 "control shift O", "toggle-componentOrientation", 1447 "ESCAPE", "reset-field-edit", 1448 "UP", "increment", 1449 "KP_UP", "increment", 1450 "DOWN", "decrement", 1451 "KP_DOWN", "decrement", 1452 }), 1453 1454 "PasswordField.font", monospacedPlain12, 1455 "PasswordField.background", window, 1456 "PasswordField.foreground", textText, 1457 "PasswordField.inactiveForeground", textInactiveText, 1458 "PasswordField.inactiveBackground", control, 1459 "PasswordField.selectionBackground", textHighlight, 1460 "PasswordField.selectionForeground", textHighlightText, 1461 "PasswordField.caretForeground", textText, 1462 "PasswordField.caretBlinkRate", caretBlinkRate, 1463 "PasswordField.border", textFieldBorder, 1464 "PasswordField.margin", zeroInsets, 1465 1466 "TextArea.font", monospacedPlain12, 1467 "TextArea.background", window, 1468 "TextArea.foreground", textText, 1469 "TextArea.inactiveForeground", textInactiveText, 1470 "TextArea.selectionBackground", textHighlight, 1471 "TextArea.selectionForeground", textHighlightText, 1472 "TextArea.caretForeground", textText, 1473 "TextArea.caretBlinkRate", caretBlinkRate, 1474 "TextArea.border", marginBorder, 1475 "TextArea.margin", zeroInsets, 1476 1477 "TextPane.font", serifPlain12, 1478 "TextPane.background", white, 1479 "TextPane.foreground", textText, 1480 "TextPane.selectionBackground", textHighlight, 1481 "TextPane.selectionForeground", textHighlightText, 1482 "TextPane.caretForeground", textText, 1483 "TextPane.caretBlinkRate", caretBlinkRate, 1484 "TextPane.inactiveForeground", textInactiveText, 1485 "TextPane.border", marginBorder, 1486 "TextPane.margin", editorMargin, 1487 1488 "EditorPane.font", serifPlain12, 1489 "EditorPane.background", white, 1490 "EditorPane.foreground", textText, 1491 "EditorPane.selectionBackground", textHighlight, 1492 "EditorPane.selectionForeground", textHighlightText, 1493 "EditorPane.caretForeground", textText, 1494 "EditorPane.caretBlinkRate", caretBlinkRate, 1495 "EditorPane.inactiveForeground", textInactiveText, 1496 "EditorPane.border", marginBorder, 1497 "EditorPane.margin", editorMargin, 1498 1499 "TitledBorder.font", dialogPlain12, 1501 "TitledBorder.titleColor", controlText, 1502 "TitledBorder.border", etchedBorder, 1503 1504 "ToolBar.font", dialogPlain12, 1506 "ToolBar.background", control, 1507 "ToolBar.foreground", controlText, 1508 "ToolBar.shadow", controlShadow, 1509 "ToolBar.darkShadow", controlDkShadow, 1510 "ToolBar.light", controlHighlight, 1511 "ToolBar.highlight", controlLtHighlight, 1512 "ToolBar.dockingBackground", control, 1513 "ToolBar.dockingForeground", red, 1514 "ToolBar.floatingBackground", control, 1515 "ToolBar.floatingForeground", darkGray, 1516 "ToolBar.border", etchedBorder, 1517 "ToolBar.separatorSize", toolBarSeparatorSize, 1518 "ToolBar.ancestorInputMap", 1519 new UIDefaults.LazyInputMap (new Object [] { 1520 "UP", "navigateUp", 1521 "KP_UP", "navigateUp", 1522 "DOWN", "navigateDown", 1523 "KP_DOWN", "navigateDown", 1524 "LEFT", "navigateLeft", 1525 "KP_LEFT", "navigateLeft", 1526 "RIGHT", "navigateRight", 1527 "KP_RIGHT", "navigateRight" 1528 }), 1529 1530 "ToolTip.font", sansSerifPlain12, 1532 "ToolTip.background", table.get("info"), 1533 "ToolTip.foreground", table.get("infoText"), 1534 "ToolTip.border", blackLineBorder, 1535 1538 "Tree.paintLines", Boolean.TRUE, 1540 "Tree.lineTypeDashed", Boolean.FALSE, 1541 "Tree.font", dialogPlain12, 1542 "Tree.background", window, 1543 "Tree.foreground", textText, 1544 "Tree.hash", gray, 1545 "Tree.textForeground", textText, 1546 "Tree.textBackground", table.get("text"), 1547 "Tree.selectionForeground", textHighlightText, 1548 "Tree.selectionBackground", textHighlight, 1549 "Tree.selectionBorderColor", black, 1550 "Tree.editorBorder", blackLineBorder, 1551 "Tree.leftChildIndent", new Integer (7), 1552 "Tree.rightChildIndent", new Integer (13), 1553 "Tree.rowHeight", new Integer (16), 1554 "Tree.scrollsOnExpand", Boolean.TRUE, 1555 "Tree.openIcon", SwingUtilities2.makeIcon(getClass(), 1556 BasicLookAndFeel .class, 1557 "icons/TreeOpen.gif"), 1558 "Tree.closedIcon", SwingUtilities2.makeIcon(getClass(), 1559 BasicLookAndFeel .class, 1560 "icons/TreeClosed.gif"), 1561 "Tree.leafIcon", SwingUtilities2.makeIcon(getClass(), 1562 BasicLookAndFeel .class, 1563 "icons/TreeLeaf.gif"), 1564 "Tree.expandedIcon", null, 1565 "Tree.collapsedIcon", null, 1566 "Tree.changeSelectionWithFocus", Boolean.TRUE, 1567 "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE, 1568 "Tree.timeFactor", oneThousand, 1569 "Tree.focusInputMap", 1570 new UIDefaults.LazyInputMap (new Object [] { 1571 "ctrl C", "copy", 1572 "ctrl V", "paste", 1573 "ctrl X", "cut", 1574 "COPY", "copy", 1575 "PASTE", "paste", 1576 "CUT", "cut", 1577 "UP", "selectPrevious", 1578 "KP_UP", "selectPrevious", 1579 "shift UP", "selectPreviousExtendSelection", 1580 "shift KP_UP", "selectPreviousExtendSelection", 1581 "ctrl shift UP", "selectPreviousExtendSelection", 1582 "ctrl shift KP_UP", "selectPreviousExtendSelection", 1583 "ctrl UP", "selectPreviousChangeLead", 1584 "ctrl KP_UP", "selectPreviousChangeLead", 1585 "DOWN", "selectNext", 1586 "KP_DOWN", "selectNext", 1587 "shift DOWN", "selectNextExtendSelection", 1588 "shift KP_DOWN", "selectNextExtendSelection", 1589 "ctrl shift DOWN", "selectNextExtendSelection", 1590 "ctrl shift KP_DOWN", "selectNextExtendSelection", 1591 "ctrl DOWN", "selectNextChangeLead", 1592 "ctrl KP_DOWN", "selectNextChangeLead", 1593 "RIGHT", "selectChild", 1594 "KP_RIGHT", "selectChild", 1595 "LEFT", "selectParent", 1596 "KP_LEFT", "selectParent", 1597 "PAGE_UP", "scrollUpChangeSelection", 1598 "shift PAGE_UP", "scrollUpExtendSelection", 1599 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 1600 "ctrl PAGE_UP", "scrollUpChangeLead", 1601 "PAGE_DOWN", "scrollDownChangeSelection", 1602 "shift PAGE_DOWN", "scrollDownExtendSelection", 1603 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 1604 "ctrl PAGE_DOWN", "scrollDownChangeLead", 1605 "HOME", "selectFirst", 1606 "shift HOME", "selectFirstExtendSelection", 1607 "ctrl shift HOME", "selectFirstExtendSelection", 1608 "ctrl HOME", "selectFirstChangeLead", 1609 "END", "selectLast", 1610 "shift END", "selectLastExtendSelection", 1611 "ctrl shift END", "selectLastExtendSelection", 1612 "ctrl END", "selectLastChangeLead", 1613 "F2", "startEditing", 1614 "ctrl A", "selectAll", 1615 "ctrl SLASH", "selectAll", 1616 "ctrl BACK_SLASH", "clearSelection", 1617 "ctrl LEFT", "scrollLeft", 1618 "ctrl KP_LEFT", "scrollLeft", 1619 "ctrl RIGHT", "scrollRight", 1620 "ctrl KP_RIGHT", "scrollRight", 1621 "SPACE", "addToSelection", 1622 "ctrl SPACE", "toggleAndAnchor", 1623 "shift SPACE", "extendTo", 1624 "ctrl shift SPACE", "moveSelectionTo" 1625 }), 1626 "Tree.focusInputMap.RightToLeft", 1627 new UIDefaults.LazyInputMap (new Object [] { 1628 "RIGHT", "selectParent", 1629 "KP_RIGHT", "selectParent", 1630 "LEFT", "selectChild", 1631 "KP_LEFT", "selectChild", 1632 }), 1633 "Tree.ancestorInputMap", 1634 new UIDefaults.LazyInputMap (new Object [] { 1635 "ESCAPE", "cancel" 1636 }), 1637 "RootPane.ancestorInputMap", 1640 new UIDefaults.LazyInputMap (new Object [] { 1641 "shift F10", "postPopup", 1642 }), 1643 1644 "RootPane.defaultButtonWindowKeyBindings", new Object [] { 1647 "ENTER", "press", 1648 "released ENTER", "release", 1649 "ctrl ENTER", "press", 1650 "ctrl released ENTER", "release" 1651 }, 1652 }; 1653 1654 table.putDefaults(defaults); 1655 } 1656 1657 1658 1662 static Object getUIOfType(ComponentUI ui, Class klass) { 1663 if (klass.isInstance(ui)) { 1664 return ui; 1665 } 1666 return null; 1667 } 1668 1669 1672 1694 protected ActionMap getAudioActionMap() { 1695 ActionMap audioActionMap = (ActionMap )UIManager.get( 1696 "AuditoryCues.actionMap"); 1697 if (audioActionMap == null) { 1698 Object [] acList = (Object [])UIManager.get("AuditoryCues.cueList"); 1699 if (acList != null) { 1700 audioActionMap = new ActionMapUIResource(); 1701 for(int counter = acList.length-1; counter >= 0; counter--) { 1702 audioActionMap.put(acList[counter], 1703 createAudioAction(acList[counter])); 1704 } 1705 } 1706 UIManager.getLookAndFeelDefaults().put("AuditoryCues.actionMap", 1707 audioActionMap); 1708 } 1709 return audioActionMap; 1710 } 1711 1712 1728 protected Action createAudioAction(Object key) { 1729 if (key != null) { 1730 String audioKey = (String )key; 1731 String audioValue = (String )UIManager.get(key); 1732 return new AudioAction(audioKey, audioValue); 1733 } else { 1734 return null; 1735 } 1736 } 1737 1738 1746 private class AudioAction extends AbstractAction implements LineListener { 1747 private String audioResource; 1753 private byte[] audioBuffer; 1754 1755 1760 public AudioAction(String name, String resource) { 1761 super(name); 1762 audioResource = resource; 1763 } 1764 1765 public void actionPerformed(ActionEvent e) { 1766 if (audioBuffer == null) { 1767 audioBuffer = loadAudioData(audioResource); 1768 } 1769 if (audioBuffer != null) { 1770 cancelCurrentSound(null); 1771 try { 1772 AudioInputStream soundStream = 1773 AudioSystem.getAudioInputStream( 1774 new ByteArrayInputStream(audioBuffer)); 1775 DataLine.Info info = 1776 new DataLine.Info(Clip.class, soundStream.getFormat()); 1777 Clip clip = (Clip) AudioSystem.getLine(info); 1778 clip.open(soundStream); 1779 clip.addLineListener(this); 1780 1781 synchronized(audioLock) { 1782 clipPlaying = clip; 1783 } 1784 1785 clip.start(); 1786 } catch (Exception ex) {} 1787 } 1788 } 1789 1790 public void update(LineEvent event) { 1791 if (event.getType() == LineEvent.Type.STOP) { 1792 cancelCurrentSound((Clip)event.getLine()); 1793 } 1794 } 1795 1796 1800 private void cancelCurrentSound(Clip clip) { 1801 Clip lastClip = null; 1802 1803 synchronized(audioLock) { 1804 if (clip == null || clip == clipPlaying) { 1805 lastClip = clipPlaying; 1806 clipPlaying = null; 1807 } 1808 } 1809 1810 if (lastClip != null) { 1811 lastClip.removeLineListener(this); 1812 lastClip.close(); 1813 } 1814 } 1815 } 1816 1817 1831 private byte[] loadAudioData(final String soundFile){ 1832 if (soundFile == null) { 1833 return null; 1834 } 1835 1842 byte[] buffer = (byte[])AccessController.doPrivileged( 1843 new PrivilegedAction () { 1844 public Object run() { 1845 try { 1846 InputStream resource = BasicLookAndFeel.this. 1847 getClass().getResourceAsStream(soundFile); 1848 if (resource == null) { 1849 return null; 1850 } 1851 BufferedInputStream in = 1852 new BufferedInputStream(resource); 1853 ByteArrayOutputStream out = 1854 new ByteArrayOutputStream(1024); 1855 byte[] buffer = new byte[1024]; 1856 int n; 1857 while ((n = in.read(buffer)) > 0) { 1858 out.write(buffer, 0, n); 1859 } 1860 in.close(); 1861 out.flush(); 1862 buffer = out.toByteArray(); 1863 return buffer; 1864 } catch (IOException ioe) { 1865 System.err.println(ioe.toString()); 1866 return null; 1867 } 1868 } 1869 }); 1870 if (buffer == null) { 1871 System.err.println(getClass().getName() + "/" + 1872 soundFile + " not found."); 1873 return null; 1874 } 1875 if (buffer.length == 0) { 1876 System.err.println("warning: " + soundFile + 1877 " is zero-length"); 1878 return null; 1879 } 1880 return buffer; 1881 } 1882 1883 1898 protected void playSound(Action audioAction) { 1899 if (audioAction != null) { 1900 Object [] audioStrings = (Object []) 1901 UIManager.get("AuditoryCues.playList"); 1902 if (audioStrings != null) { 1903 HashSet audioCues = new HashSet(); 1905 for (int i = 0; i < audioStrings.length; i++) { 1906 audioCues.add(audioStrings[i]); 1907 } 1908 String actionName = (String )audioAction.getValue(Action.NAME); 1910 if (audioCues.contains(actionName)) { 1912 audioAction.actionPerformed(new 1913 ActionEvent(this, ActionEvent.ACTION_PERFORMED, 1914 actionName)); 1915 } 1916 } 1917 } 1918 } 1919 1920 1921 1925 static void installAudioActionMap(ActionMap map) { 1926 LookAndFeel laf = UIManager.getLookAndFeel(); 1927 if (laf instanceof BasicLookAndFeel ) { 1928 map.setParent(((BasicLookAndFeel )laf).getAudioActionMap()); 1929 } 1930 } 1931 1932 1933 1939 static void playSound(JComponent c, Object actionKey) { 1940 LookAndFeel laf = UIManager.getLookAndFeel(); 1941 if (laf instanceof BasicLookAndFeel ) { 1942 ActionMap map = c.getActionMap(); 1943 if (map != null) { 1944 Action audioAction = map.get(actionKey); 1945 if (audioAction != null) { 1946 ((BasicLookAndFeel )laf).playSound(audioAction); 1948 } 1949 } 1950 } 1951 } 1952 1953 1954 static Component compositeRequestFocus(Component component) { 1957 if (component instanceof Container ) { 1958 Container container = (Container )component; 1959 if (container.isFocusCycleRoot()) { 1960 FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); 1961 Component comp = policy.getDefaultComponent(container); 1962 if (comp!=null) { 1963 comp.requestFocus(); 1964 return comp; 1965 } 1966 } 1967 Container rootAncestor = container.getFocusCycleRootAncestor(); 1968 if (rootAncestor!=null) { 1969 FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); 1970 Component comp = policy.getComponentAfter(rootAncestor, container); 1971 1972 if (comp!=null && SwingUtilities.isDescendingFrom(comp, container)) { 1973 comp.requestFocus(); 1974 return comp; 1975 } 1976 } 1977 } 1978 if (component.isFocusable()) { 1979 component.requestFocus(); 1980 return component; 1981 } 1982 return null; 1983 } 1984 1985 1990 void createdPopup() { 1991 if (invocator == null) { 1992 invocator = new PopupInvocationHelper(); 1993 hasPopups = true; 1994 1995 disposer = new PropertyChangeListener () { 1999 public void propertyChange(PropertyChangeEvent prpChg) { 2000 uninitialize(); 2001 } 2002 }; 2003 AppContext.getAppContext().addPropertyChangeListener( 2004 AppContext.GUI_DISPOSED, 2005 disposer); 2006 } 2007 } 2008 2009 2013 class PopupInvocationHelper implements AWTEventListener,PrivilegedAction { 2014 PopupInvocationHelper() { 2015 super(); 2016 AccessController.doPrivileged(this); 2017 } 2018 2019 public Object run() { 2020 Toolkit tk = Toolkit.getDefaultToolkit(); 2021 if(invocator == null) { 2022 tk.addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK); 2023 } else { 2024 tk.removeAWTEventListener(invocator); 2025 } 2026 return null; 2028 } 2029 2030 public void eventDispatched(AWTEvent ev) { 2031 if((ev.getID() & AWTEvent.MOUSE_EVENT_MASK) != 0) { 2032 MouseEvent me = (MouseEvent) ev; 2033 if(me.isPopupTrigger()) { 2034 MenuElement [] elems = MenuSelectionManager 2035 .defaultManager() 2036 .getSelectedPath(); 2037 if(elems != null && elems.length != 0) { 2038 return; 2039 } 2041 Object c = me.getSource(); 2042 if(c instanceof JComponent ) { 2043 JComponent src = (JComponent ) c; 2044 if(src.getComponentPopupMenu() != null) { 2045 Point pt = src.getPopupLocation(me); 2046 if(pt == null) { 2047 pt = me.getPoint(); 2048 } 2049 src.getComponentPopupMenu().show(src, pt.x, pt.y); 2050 me.consume(); 2051 } 2052 } 2053 } 2054 } 2055 } 2056 } 2057} 2058 | Popular Tags |