windowslookandfeel.java
来自「JAVA 所有包」· Java 代码 · 共 1,352 行 · 第 1/5 页
JAVA
1,352 行
toolkit); Object TitleButtonWidth = new DesktopProperty( "win.frame.captionButtonWidth", new Integer(16), toolkit); Object TitleButtonHeight = new DesktopProperty( "win.frame.captionButtonHeight", new Integer(16), toolkit); Object InactiveTextColor = new DesktopProperty( "win.text.grayedTextColor", table.get("textInactiveText"), toolkit); Object ScrollbarBackgroundColor = new DesktopProperty( "win.scrollbar.backgroundColor", table.get("scrollbar"), toolkit); Object TextBackground = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR, WindowBackgroundColor); //The following four lines were commented out as part of bug 4991597 //This code *is* correct, however it differs from WindowsXP and is, apparently //a Windows XP bug. Until Windows fixes this bug, we shall also exhibit the same //behavior //Object ReadOnlyTextBackground = new XPColorValue(Part.EP_EDITTEXT, State.READONLY, Prop.FILLCOLOR, // ControlBackgroundColor); //Object DisabledTextBackground = new XPColorValue(Part.EP_EDITTEXT, State.DISABLED, Prop.FILLCOLOR, // ControlBackgroundColor); Object ReadOnlyTextBackground = ControlBackgroundColor; Object DisabledTextBackground = ControlBackgroundColor; Object MenuFont = dialogPlain12; Object FixedControlFont = monospacedPlain12; Object ControlFont = dialogPlain12; Object MessageFont = dialogPlain12; Object WindowFont = dialogBold12; Object ToolTipFont = sansSerifPlain12; Object IconFont = ControlFont; Object scrollBarWidth = new DesktopProperty("win.scrollbar.width", new Integer(16), toolkit); Object menuBarHeight = new DesktopProperty("win.menu.height", null, toolkit); Object hotTrackingOn = new DesktopProperty("win.item.hotTrackingOn", true, 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); /* Put the desktop AA settings in the defaults. * JComponent.setUI() retrieves this and makes it available * as a client property on the JComponent. Use the same key name * for both client property and UIDefaults. * Also need to set up listeners for changes in these settings. */ Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true); table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo); this.aaSettings = new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS); } if (useSystemFontSizeSettings) { MenuFont = new WindowsFontSizeProperty("win.menu.font.height", toolkit, Font.DIALOG, Font.PLAIN, 12); FixedControlFont = new WindowsFontSizeProperty( "win.ansiFixed.font.height", toolkit, Font.MONOSPACED, Font.PLAIN, 12); ControlFont = new WindowsFontSizeProperty( "win.defaultGUI.font.height", toolkit, Font.DIALOG, Font.PLAIN, 12); MessageFont = new WindowsFontSizeProperty( "win.messagebox.font.height", toolkit, Font.DIALOG, Font.PLAIN, 12); WindowFont = new WindowsFontSizeProperty( "win.frame.captionFont.height", toolkit, Font.DIALOG, Font.BOLD, 12); ToolTipFont = new WindowsFontSizeProperty( "win.tooltip.font.height", toolkit, Font.SANS_SERIF, Font.PLAIN, 12); IconFont = new WindowsFontSizeProperty( "win.icon.font.height", toolkit, Font.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, Button.shadow, Button.darkShadow, // Button.disabledForground, and Button.disabledShadow are only // used for Windows Classic. Windows XP will use colors // from the current visual style. "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 XPValue(new Integer(3), new Integer(5)), "Button.dashedRectGapY", new XPValue(new Integer(3), new Integer(4)), "Button.dashedRectGapWidth", new XPValue(new Integer(6), new Integer(10)), "Button.dashedRectGapHeight", new XPValue(new Integer(6), new Integer(8)), "Button.textShiftOffset", new XPValue(new Integer(0), 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", WindowTextColor, "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" }), // margin is 2 all the way around, BasicBorders.RadioButtonBorder // (checkbox uses RadioButtonBorder) is 2 all the way around too. "CheckBox.totalInsets", new Insets(4, 4, 4, 4), "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.editorBorder", new XPValue(new EmptyBorder(1,2,1,1), new EmptyBorder(1,4,1,4)), "ComboBox.disabledBackground", new XPColorValue(Part.CP_COMBOBOX, State.DISABLED, Prop.FILLCOLOR, DisabledTextBackground), "ComboBox.disabledForeground", new XPColorValue(Part.CP_COMBOBOX, State.DISABLED, Prop.TEXTCOLOR, 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", "alt DOWN", "togglePopup", "alt KP_DOWN", "togglePopup", "alt UP", "togglePopup", "alt KP_UP", "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, "EditorPane.inactiveBackground", WindowBackgroundColor, "EditorPane.disabledBackground", DisabledTextBackground, "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,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?