windowslookandfeel.java
来自「java jdk 1.4的源码」· Java 代码 · 共 1,459 行 · 第 1/5 页
JAVA
1,459 行
// *** TextPane "TextPane.font", ControlFont, "TextPane.background", WindowBackgroundColor, "TextPane.foreground", WindowTextColor, "TextPane.selectionBackground", SelectionBackgroundColor, "TextPane.selectionForeground", SelectionTextColor, "TextPane.caretForeground", WindowTextColor, // *** TitledBorder "TitledBorder.font", ControlFont, "TitledBorder.titleColor", ControlTextColor, // *** ToggleButton "ToggleButton.font", ControlFont, "ToggleButton.background", ControlBackgroundColor, "ToggleButton.foreground", ControlTextColor, "ToggleButton.shadow", ControlShadowColor, "ToggleButton.darkShadow", ControlDarkShadowColor, "ToggleButton.light", ControlLightColor, "ToggleButton.highlight", ControlHighlightColor, "ToggleButton.focus", ControlTextColor, "ToggleButton.textShiftOffset", new Integer(1), "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), // *** ToolBar "ToolBar.font", MenuFont, "ToolBar.background", ControlBackgroundColor, "ToolBar.foreground", ControlTextColor, "ToolBar.shadow", ControlShadowColor, "ToolBar.darkShadow", ControlDarkShadowColor, "ToolBar.light", ControlLightColor, "ToolBar.highlight", ControlHighlightColor, "ToolBar.dockingBackground", ControlBackgroundColor, "ToolBar.dockingForeground", red, "ToolBar.floatingBackground", ControlBackgroundColor, "ToolBar.floatingForeground", darkGray, "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "UP", "navigateUp", "KP_UP", "navigateUp", "DOWN", "navigateDown", "KP_DOWN", "navigateDown", "LEFT", "navigateLeft", "KP_LEFT", "navigateLeft", "RIGHT", "navigateRight", "KP_RIGHT", "navigateRight" }), "ToolBar.separatorSize", null, // *** ToolTip "ToolTip.font", ToolTipFont, "ToolTip.background", new DesktopProperty( "win.tooltip.backgroundColor", table.get("info"), toolkit), "ToolTip.foreground", new DesktopProperty( "win.tooltip.textColor", table.get("infoText"), toolkit), // *** Tree "Tree.font", ControlFont, "Tree.background", WindowBackgroundColor, "Tree.foreground", WindowTextColor, "Tree.hash", gray, "Tree.textForeground", WindowTextColor, "Tree.textBackground", WindowBackgroundColor, "Tree.selectionForeground", SelectionTextColor, "Tree.selectionBackground", SelectionBackgroundColor, "Tree.expandedIcon", treeExpandedIcon, "Tree.collapsedIcon", treeCollapsedIcon, "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl C", "copy", "ctrl V", "paste", "ctrl X", "cut", "COPY", "copy", "PASTE", "paste", "CUT", "cut", "UP", "selectPrevious", "KP_UP", "selectPrevious", "shift UP", "selectPreviousExtendSelection", "shift KP_UP", "selectPreviousExtendSelection", "DOWN", "selectNext", "KP_DOWN", "selectNext", "shift DOWN", "selectNextExtendSelection", "shift KP_DOWN", "selectNextExtendSelection", "RIGHT", "selectChild", "KP_RIGHT", "selectChild", "LEFT", "selectParent", "KP_LEFT", "selectParent", "PAGE_UP", "scrollUpChangeSelection", "shift PAGE_UP", "scrollUpExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "shift PAGE_DOWN", "scrollDownExtendSelection", "HOME", "selectFirst", "shift HOME", "selectFirstExtendSelection", "END", "selectLast", "shift END", "selectLastExtendSelection", "F2", "startEditing", "ctrl A", "selectAll", "ctrl SLASH", "selectAll", "ctrl BACK_SLASH", "clearSelection", "ctrl SPACE", "toggleSelectionPreserveAnchor", "shift SPACE", "extendSelection", "ctrl HOME", "selectFirstChangeLead", "ctrl END", "selectLastChangeLead", "ctrl UP", "selectPreviousChangeLead", "ctrl KP_UP", "selectPreviousChangeLead", "ctrl DOWN", "selectNextChangeLead", "ctrl KP_DOWN", "selectNextChangeLead", "ctrl PAGE_DOWN", "scrollDownChangeLead", "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", "ctrl PAGE_UP", "scrollUpChangeLead", "ctrl shift PAGE_UP", "scrollUpExtendSelection", "ctrl LEFT", "scrollLeft", "ctrl KP_LEFT", "scrollLeft", "ctrl RIGHT", "scrollRight", "ctrl KP_RIGHT", "scrollRight", "SPACE", "toggleSelectionPreserveAnchor", }), "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), // *** Viewport "Viewport.font", ControlFont, "Viewport.background", ControlBackgroundColor, "Viewport.foreground", WindowTextColor, }; table.putDefaults(defaults); table.putDefaults(getLazyValueDefaults()); } /** * If we support loading of fonts from the desktop this will return * a DesktopProperty representing the font. If the font can't be * represented in the current encoding this will return null and * turn off the use of system fonts. */ private Object getDesktopFontValue(String fontName, Object backup, Toolkit kit) { if (useSystemFontSettings) { DesktopProperty prop = new DesktopProperty(fontName, backup, kit); Font font = (Font)prop.createValue(null); if (!SunGraphicsEnvironment.isLogicalFont(font) && !SunGraphicsEnvironment.fontSupportsDefaultEncoding(font)) { // If this font can't be supported then turn off using // system fonts and fallback to use system font sizes. useSystemFontSettings = false; useSystemFontSizeSettings = true; return null; } return prop; } return null; } // When a desktop property change is detected, these classes must be // reinitialized in the defaults table to ensure the classes reference // the updated desktop property values (colors mostly) // private Object[] getLazyValueDefaults() { XPStyle xp = XPStyle.getXP(); Object buttonBorder; if (xp != null) { buttonBorder = xp.getBorder("button.pushbutton"); } else { buttonBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.basic.BasicBorders", "getButtonBorder"); } Object textFieldBorder; Object textFieldMargin; if (xp != null) { textFieldBorder = xp.getBorder("edit"); textFieldMargin = new InsetsUIResource(1, 5, 2, 4); } else { textFieldBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.basic.BasicBorders", "getTextFieldBorder"); textFieldMargin = new InsetsUIResource(1, 1, 1, 1); } Object spinnerBorder = textFieldBorder; Object comboBoxBorder = (xp != null) ? xp.getBorder("combobox") : textFieldBorder; // For focus rectangle for cells and trees. Object focusCellHighlightBorder = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsBorders", "getFocusCellHighlightBorder"); Object etchedBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.BorderUIResource", "getEtchedBorderUIResource"); Object internalFrameBorder = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsBorders", "getInternalFrameBorder"); Object loweredBevelBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.BorderUIResource", "getLoweredBevelBorderUIResource"); Object marginBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.basic.BasicBorders$MarginBorder"); Object menuBarBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.basic.BasicBorders", "getMenuBarBorder"); Object popupMenuBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.basic.BasicBorders", "getInternalFrameBorder"); // *** ProgressBar Object progressBarBorder = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsBorders", "getProgressBarBorder"); Object radioButtonBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.basic.BasicBorders", "getRadioButtonBorder"); Object scrollPaneBorder = (xp != null) ? xp.getBorder("listbox") : textFieldBorder; Object tableScrollPaneBorder = (xp != null) ? scrollPaneBorder : loweredBevelBorder; Object tableHeaderBorder = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsBorders", "getTableHeaderBorder"); // *** ToolBar Object toolBarBorder = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsBorders", "getToolBarBorder"); // *** ToolTips Object toolTipBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.BorderUIResource", "getBlackLineBorderUIResource"); Object checkBoxIcon = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsIconFactory", "getCheckBoxIcon"); Object radioButtonIcon = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsIconFactory", "getRadioButtonIcon"); Object menuItemCheckIcon = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsIconFactory", "getMenuItemCheckIcon"); Object menuItemArrowIcon = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsIconFactory", "getMenuItemArrowIcon"); Object menuArrowIcon = new UIDefaults.ProxyLazyValue( "com.sun.java.swing.plaf.windows.WindowsIconFactory", "getMenuArrowIcon"); Object[] lazyDefaults = { "Button.border", buttonBorder, "CheckBox.border", radioButtonBorder, "ComboBox.border", comboBoxBorder, "DesktopIcon.border", internalFrameBorder, "FormattedTextField.border", textFieldBorder, "FormattedTextField.margin", textFieldMargin, "InternalFrame.border", internalFrameBorder, "List.focusCellHighlightBorder", focusCellHighlightBorder, "Table.focusCellHighlightBorder", focusCellHighlightBorder, "Tree.selectionBorderColor", focusCellHighlightBorder, "Menu.border", marginBorder, "MenuBar.border", menuBarBorder, "MenuItem.border", marginBorder, "PasswordField.border", textFieldBorder, "
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?