windowslookandfeel.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 1,348 行 · 第 1/5 页

JAVA
1,348
字号
	Object scrollBarWidth = new DesktopProperty("win.scrollbar.width",						    new Integer(16), toolkit);	Object showMnemonics = new DesktopProperty("win.menu.keyboardCuesOn",						     Boolean.TRUE, toolkit);        if (useSystemFontSettings) {            MenuFont = getDesktopFontValue("win.menu.font", MenuFont, toolkit);            FixedControlFont = getDesktopFontValue("win.ansiFixed.font",                                                   FixedControlFont, toolkit);            ControlFont = getDesktopFontValue("win.defaultGUI.font",                                              ControlFont, toolkit);            MessageFont = getDesktopFontValue("win.messagebox.font",                                              MessageFont, toolkit);            WindowFont = getDesktopFontValue("win.frame.captionFont",                                             WindowFont, toolkit);	    IconFont    = getDesktopFontValue("win.icon.font",					      IconFont, toolkit);            ToolTipFont = getDesktopFontValue("win.tooltip.font", ToolTipFont,                                              toolkit);        }        if (useSystemFontSizeSettings) {            MenuFont = new WindowsFontSizeProperty("win.menu.font.height",                                  toolkit, "Dialog", Font.PLAIN, 12);            FixedControlFont = new WindowsFontSizeProperty(                       "win.ansiFixed.font.height", toolkit, "MonoSpaced",                       Font.PLAIN, 12);            ControlFont = new WindowsFontSizeProperty(                        "win.defaultGUI.font.height", toolkit, "Dialog",                        Font.PLAIN, 12);            MessageFont = new WindowsFontSizeProperty(                              "win.messagebox.font.height",                              toolkit, "Dialog", Font.PLAIN, 12);            WindowFont = new WindowsFontSizeProperty(                             "win.frame.captionFont.height", toolkit,                             "Dialog", Font.BOLD, 12);            ToolTipFont = new WindowsFontSizeProperty(                              "win.tooltip.font.height", toolkit, "SansSerif",                              Font.PLAIN, 12);	    IconFont    = new WindowsFontSizeProperty(			      "win.icon.font.height", toolkit, "Dialog",			      Font.PLAIN, 12);        }	if (!(this instanceof WindowsClassicLookAndFeel) &&	    (System.getProperty("os.name").startsWith("Windows ") &&	     System.getProperty("os.version").compareTo("5.1") >= 0) &&	    AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) {	    // These desktop properties are not used directly, but are needed to	    // trigger realoading of UI's.	    this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive");	    this.dllName     = new TriggerDesktopProperty("win.xpstyle.dllName");	    this.colorName   = new TriggerDesktopProperty("win.xpstyle.colorName");	    this.sizeName    = new TriggerDesktopProperty("win.xpstyle.sizeName");	}        Object[] defaults = {	    // *** Auditory Feedback	    // this key defines which of the various cues to render 	    // Overridden from BasicL&F. This L&F should play all sounds	    // all the time. The infrastructure decides what to play.            // This is disabled until sound bugs can be resolved.	    "AuditoryCues.playList", null, // table.get("AuditoryCues.cueList"),	    "Application.useSystemFontSettings", Boolean.valueOf(useSystemFontSettings),	    "TextField.focusInputMap", fieldInputMap,	    "PasswordField.focusInputMap", passwordInputMap,	    "TextArea.focusInputMap", multilineInputMap,	    "TextPane.focusInputMap", multilineInputMap,	    "EditorPane.focusInputMap", multilineInputMap,	    // Buttons	    "Button.font", ControlFont,	    "Button.background", ControlBackgroundColor,	    "Button.foreground", ControlTextColor,	    "Button.shadow", ControlShadowColor,            "Button.darkShadow", ControlDarkShadowColor,            "Button.light", ControlLightColor,            "Button.highlight", ControlHighlightColor,	    "Button.disabledForeground", InactiveTextColor,	    "Button.disabledShadow", ControlHighlightColor,            "Button.focus", black,	    "Button.dashedRectGapX", new Integer(5),	    "Button.dashedRectGapY", new Integer(4),	    "Button.dashedRectGapWidth", new Integer(10),	    "Button.dashedRectGapHeight", new Integer(8),	    "Button.textShiftOffset", new Integer(1),	    // W2K keyboard navigation hidding.	    "Button.showMnemonics", showMnemonics,             "Button.focusInputMap",               new UIDefaults.LazyInputMap(new Object[] {                            "SPACE", "pressed",                   "released SPACE", "released"                 }),	    "CheckBox.font", ControlFont,            "CheckBox.interiorBackground", WindowBackgroundColor, 	    "CheckBox.background", ControlBackgroundColor,	    "CheckBox.foreground", ControlTextColor,            "CheckBox.shadow", ControlShadowColor,            "CheckBox.darkShadow", ControlDarkShadowColor,            "CheckBox.light", ControlLightColor,            "CheckBox.highlight", ControlHighlightColor,            "CheckBox.focus", black,	    "CheckBox.focusInputMap",	       new UIDefaults.LazyInputMap(new Object[] {		            "SPACE", "pressed",                   "released SPACE", "released"		 }),            "CheckBoxMenuItem.font", MenuFont,	    "CheckBoxMenuItem.background", MenuBackgroundColor,	    "CheckBoxMenuItem.foreground", MenuTextColor,	    "CheckBoxMenuItem.selectionForeground", SelectionTextColor,	    "CheckBoxMenuItem.selectionBackground", SelectionBackgroundColor,	    "CheckBoxMenuItem.acceleratorForeground", MenuTextColor,	    "CheckBoxMenuItem.acceleratorSelectionForeground", SelectionTextColor,	    "CheckBoxMenuItem.commandSound", "win.sound.menuCommand",	    "ComboBox.font", ControlFont,	    "ComboBox.background", WindowBackgroundColor,	    "ComboBox.foreground", WindowTextColor,	    "ComboBox.buttonBackground", ControlBackgroundColor,	    "ComboBox.buttonShadow", ControlShadowColor,	    "ComboBox.buttonDarkShadow", ControlDarkShadowColor,	    "ComboBox.buttonHighlight", ControlHighlightColor,            "ComboBox.selectionBackground", SelectionBackgroundColor,            "ComboBox.selectionForeground", SelectionTextColor,            "ComboBox.disabledBackground", ControlBackgroundColor,            "ComboBox.disabledForeground", InactiveTextColor,	    "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {		   "ESCAPE", "hidePopup",		  "PAGE_UP", "pageUpPassThrough",		"PAGE_DOWN", "pageDownPassThrough",		     "HOME", "homePassThrough",		      "END", "endPassThrough",		     "DOWN", "selectNext2",		  "KP_DOWN", "selectNext2",		       "UP", "selectPrevious2",		    "KP_UP", "selectPrevious2",		   "ENTER", "enterPressed",		       "F4", "togglePopup"	      }),	    // DeskTop.	    "Desktop.background", new DesktopProperty(                                                 "win.desktop.backgroundColor",						  table.get("desktop"),                                                 toolkit),	    "Desktop.ancestorInputMap",	       new UIDefaults.LazyInputMap(new Object[] {		   "ctrl F5", "restore", 		   "ctrl F4", "close",		   "ctrl F7", "move", 		   "ctrl F8", "resize",		   "RIGHT", "right",		   "KP_RIGHT", "right",		   "LEFT", "left",		   "KP_LEFT", "left",		   "UP", "up",		   "KP_UP", "up",		   "DOWN", "down",		   "KP_DOWN", "down",		   "ESCAPE", "escape",		   "ctrl F9", "minimize", 		   "ctrl F10", "maximize",		   "ctrl F6", "selectNextFrame",		   "ctrl TAB", "selectNextFrame",		   "ctrl alt F6", "selectNextFrame",		   "shift ctrl alt F6", "selectPreviousFrame",                   "ctrl F12", "navigateNext",                   "shift ctrl F12", "navigatePrevious"	       }),            // DesktopIcon            "DesktopIcon.width", new Integer(160),	    "EditorPane.font", ControlFont,	    "EditorPane.background", WindowBackgroundColor,	    "EditorPane.foreground", WindowTextColor,	    "EditorPane.selectionBackground", SelectionBackgroundColor,	    "EditorPane.selectionForeground", SelectionTextColor,	    "EditorPane.caretForeground", WindowTextColor,	    "EditorPane.inactiveForeground", InactiveTextColor,	    "FileChooser.homeFolderIcon",  new LazyWindowsIcon(null,							       "icons/HomeFolder.gif"),	    "FileChooser.listFont", IconFont,            "FileChooser.listViewBackground", new XPColorValue(                Part.LVP_LISTVIEW, null, Prop.FILLCOLOR,                WindowBackgroundColor),            "FileChooser.listViewBorder", new XPBorderValue(Part.LVP_LISTVIEW,						  new SwingLazyValue(							"javax.swing.plaf.BorderUIResource",							"getLoweredBevelBorderUIResource")),	    "FileChooser.listViewIcon",    new LazyWindowsIcon("fileChooserIcon ListView",							       "icons/ListView.gif"),	    "FileChooser.listViewWindowsStyle", Boolean.TRUE,	    "FileChooser.detailsViewIcon", new LazyWindowsIcon("fileChooserIcon DetailsView",							       "icons/DetailsView.gif"),	    "FileChooser.upFolderIcon",    new LazyWindowsIcon("fileChooserIcon UpFolder",							       "icons/UpFolder.gif"),	    "FileChooser.newFolderIcon",   new LazyWindowsIcon("fileChooserIcon NewFolder",							       "icons/NewFolder.gif"),	    "FileChooser.useSystemExtensionHiding", Boolean.TRUE,            "FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I),            "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N),            "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),	    "FileChooser.usesSingleFilePane", Boolean.TRUE,	    "FileChooser.ancestorInputMap", 	       new UIDefaults.LazyInputMap(new Object[] {		     "ESCAPE", "cancelSelection",		     "F2", "editFileName",		     "F5", "refresh",		     "BACK_SPACE", "Go Up",		     "ENTER", "approveSelection"		 }),            "FileView.directoryIcon", SwingUtilities2.makeIcon(getClass(),                                                               WindowsLookAndFeel.class,                                                               "icons/Directory.gif"),            "FileView.fileIcon", SwingUtilities2.makeIcon(getClass(),                                                          WindowsLookAndFeel.class,                                                          "icons/File.gif"),            "FileView.computerIcon", SwingUtilities2.makeIcon(getClass(),                                                              WindowsLookAndFeel.class,                                                              "icons/Computer.gif"),            "FileView.hardDriveIcon", SwingUtilities2.makeIcon(getClass(),                                                               WindowsLookAndFeel.class,                                                               "icons/HardDrive.gif"),            "FileView.floppyDriveIcon", SwingUtilities2.makeIcon(getClass(),                                                                 WindowsLookAndFeel.class,                                                                 "icons/FloppyDrive.gif"),            "InternalFrame.titleFont", WindowFont,            "InternalFrame.titlePaneHeight",   TitlePaneHeight,            "InternalFrame.titleButtonWidth",  TitleButtonWidth,            "InternalFrame.titleButtonHeight", TitleButtonHeight,	    "InternalFrame.borderColor", ControlBackgroundColor,	    "InternalFrame.borderShadow", ControlShadowColor,	    "InternalFrame.borderDarkShadow", ControlDarkShadowColor,	    "InternalFrame.borderHighlight", ControlHighlightColor,	    "InternalFrame.borderLight", ControlLightColor,            "InternalFrame.borderWidth", WindowBorderWidth,            "InternalFrame.minimizeIconBackground", ControlBackgroundColor,            "InternalFrame.resizeIconHighlight", ControlLightColor,            "InternalFrame.resizeIconShadow", ControlShadowColor,            "InternalFrame.activeBorderColor", new DesktopProperty(                                                       "win.frame.activeBorderColor",                                                       table.get("windowBorder"),                                                       toolkit),            "InternalFrame.inactiveBorderColor", new DesktopProperty(                                                       "win.frame.inactiveBorderColor",                                                       table.get("windowBorder"),                                                       toolkit),	    "InternalFrame.activeTitleBackground", new DesktopProperty(                                                        "win.frame.activeCaptionColor",							 table.get("activeCaption"),                                                        toolkit),	    "InternalFrame.activeTitleGradient", new DesktopProperty(		                                        "win.frame.activeCaptionGradientColor",							 table.get("activeCaption"),                                                        toolkit),	    "InternalFrame.activeTitleForeground", new DesktopProperty(                                                        "win.frame.captionTextColor",

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?