📄 metallookandfeel.java
字号:
"TreeUI", metalPackageName + "MetalTreeUI", "RootPaneUI", metalPackageName + "MetalRootPaneUI", }; table.putDefaults(uiDefaults); } /** * Populates {@code table} with system colors. The following values are * added to {@code table}: * <table border="1" cellpadding="1" cellspacing="0" * summary="Metal's system color mapping" * valign="top" > * <tr valign="top" align="left"> * <th bgcolor="#CCCCFF" align="left">Key * <th bgcolor="#CCCCFF" align="left">Value * <tr valign="top" align="left"> * <td>"desktop" * <td>{@code theme.getDesktopColor()} * <tr valign="top" align="left"> * <td>"activeCaption" * <td>{@code theme.getWindowTitleBackground()} * <tr valign="top" align="left"> * <td>"activeCaptionText" * <td>{@code theme.getWindowTitleForeground()} * <tr valign="top" align="left"> * <td>"activeCaptionBorder" * <td>{@code theme.getPrimaryControlShadow()} * <tr valign="top" align="left"> * <td>"inactiveCaption" * <td>{@code theme.getWindowTitleInactiveBackground()} * <tr valign="top" align="left"> * <td>"inactiveCaptionText" * <td>{@code theme.getWindowTitleInactiveForeground()} * <tr valign="top" align="left"> * <td>"inactiveCaptionBorder" * <td>{@code theme.getControlShadow()} * <tr valign="top" align="left"> * <td>"window" * <td>{@code theme.getWindowBackground()} * <tr valign="top" align="left"> * <td>"windowBorder" * <td>{@code theme.getControl()} * <tr valign="top" align="left"> * <td>"windowText" * <td>{@code theme.getUserTextColor()} * <tr valign="top" align="left"> * <td>"menu" * <td>{@code theme.getMenuBackground()} * <tr valign="top" align="left"> * <td>"menuText" * <td>{@code theme.getMenuForeground()} * <tr valign="top" align="left"> * <td>"text" * <td>{@code theme.getWindowBackground()} * <tr valign="top" align="left"> * <td>"textText" * <td>{@code theme.getUserTextColor()} * <tr valign="top" align="left"> * <td>"textHighlight" * <td>{@code theme.getTextHighlightColor()} * <tr valign="top" align="left"> * <td>"textHighlightText" * <td>{@code theme.getHighlightedTextColor()} * <tr valign="top" align="left"> * <td>"textInactiveText" * <td>{@code theme.getInactiveSystemTextColor()} * <tr valign="top" align="left"> * <td>"control" * <td>{@code theme.getControl()} * <tr valign="top" align="left"> * <td>"controlText" * <td>{@code theme.getControlTextColor()} * <tr valign="top" align="left"> * <td>"controlHighlight" * <td>{@code theme.getControlHighlight()} * <tr valign="top" align="left"> * <td>"controlLtHighlight" * <td>{@code theme.getControlHighlight()} * <tr valign="top" align="left"> * <td>"controlShadow" * <td>{@code theme.getControlShadow()} * <tr valign="top" align="left"> * <td>"controlDkShadow" * <td>{@code theme.getControlDarkShadow()} * <tr valign="top" align="left"> * <td>"scrollbar" * <td>{@code theme.getControl()} * <tr valign="top" align="left"> * <td>"info" * <td>{@code theme.getPrimaryControl()} * <tr valign="top" align="left"> * <td>"infoText" * <td>{@code theme.getPrimaryControlInfo()} * </table> * The value {@code theme} corresponds to the current {@code MetalTheme}. * * @param table the {@code UIDefaults} object the values are added to * @throws NullPointerException if {@code table} is {@code null} */ protected void initSystemColorDefaults(UIDefaults table) { MetalTheme theme = getCurrentTheme(); Color control = theme.getControl(); Object[] systemColors = { "desktop", theme.getDesktopColor(), /* Color of the desktop background */ "activeCaption", theme.getWindowTitleBackground(), /* Color for captions (title bars) when they are active. */ "activeCaptionText", theme.getWindowTitleForeground(), /* Text color for text in captions (title bars). */ "activeCaptionBorder", theme.getPrimaryControlShadow(), /* Border color for caption (title bar) window borders. */ "inactiveCaption", theme.getWindowTitleInactiveBackground(), /* Color for captions (title bars) when not active. */ "inactiveCaptionText", theme.getWindowTitleInactiveForeground(), /* Text color for text in inactive captions (title bars). */ "inactiveCaptionBorder", theme.getControlShadow(), /* Border color for inactive caption (title bar) window borders. */ "window", theme.getWindowBackground(), /* Default color for the interior of windows */ "windowBorder", control, /* ??? */ "windowText", theme.getUserTextColor(), /* ??? */ "menu", theme.getMenuBackground(), /* Background color for menus */ "menuText", theme.getMenuForeground(), /* Text color for menus */ "text", theme.getWindowBackground(), /* Text background color */ "textText", theme.getUserTextColor(), /* Text foreground color */ "textHighlight", theme.getTextHighlightColor(), /* Text background color when selected */ "textHighlightText", theme.getHighlightedTextColor(), /* Text color when selected */ "textInactiveText", theme.getInactiveSystemTextColor(), /* Text color when disabled */ "control", control, /* Default color for controls (buttons, sliders, etc) */ "controlText", theme.getControlTextColor(), /* Default color for text in controls */ "controlHighlight", theme.getControlHighlight(), /* Specular highlight (opposite of the shadow) */ "controlLtHighlight", theme.getControlHighlight(), /* Highlight color for controls */ "controlShadow", theme.getControlShadow(), /* Shadow color for controls */ "controlDkShadow", theme.getControlDarkShadow(), /* Dark shadow color for controls */ "scrollbar", control, /* Scrollbar background (usually the "track") */ "info", theme.getPrimaryControl(), /* ToolTip Background */ "infoText", theme.getPrimaryControlInfo() /* ToolTip Text */ }; table.putDefaults(systemColors); } /** * Initialize the defaults table with the name of the ResourceBundle * used for getting localized defaults. */ private void initResourceBundle(UIDefaults table) { table.addResourceBundle( "com.sun.swing.internal.plaf.metal.resources.metal" ); } /** * Populates {@code table} with the defaults for metal. * * @param table the {@code UIDefaults} to add the values to * @throws NullPointerException if {@code table} is {@code null} */ protected void initComponentDefaults(UIDefaults table) { super.initComponentDefaults( table ); initResourceBundle(table); Color acceleratorForeground = getAcceleratorForeground(); Color acceleratorSelectedForeground = getAcceleratorSelectedForeground(); Color control = getControl(); Color controlHighlight = getControlHighlight(); Color controlShadow = getControlShadow(); Color controlDarkShadow = getControlDarkShadow(); Color controlTextColor = getControlTextColor(); Color focusColor = getFocusColor(); Color inactiveControlTextColor = getInactiveControlTextColor(); Color menuBackground = getMenuBackground(); Color menuSelectedBackground = getMenuSelectedBackground(); Color menuDisabledForeground = getMenuDisabledForeground(); Color menuSelectedForeground = getMenuSelectedForeground(); Color primaryControl = getPrimaryControl(); Color primaryControlDarkShadow = getPrimaryControlDarkShadow(); Color primaryControlShadow = getPrimaryControlShadow(); Color systemTextColor = getSystemTextColor(); Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0); Integer zero = new Integer(0); Object textFieldBorder = new SwingLazyValue("javax.swing.plaf.metal.MetalBorders", "getTextFieldBorder"); Object dialogBorder = new MetalLazyValue( "javax.swing.plaf.metal.MetalBorders$DialogBorder"); Object questionDialogBorder = new MetalLazyValue( "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder"); Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] { "ctrl C", DefaultEditorKit.copyAction, "ctrl V", DefaultEditorKit.pasteAction, "ctrl X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "control INSERT", DefaultEditorKit.copyAction, "shift INSERT", DefaultEditorKit.pasteAction, "shift DELETE", DefaultEditorKit.cutAction, "shift LEFT", DefaultEditorKit.selectionBackwardAction, "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, "shift RIGHT", DefaultEditorKit.selectionForwardAction, "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, "ctrl LEFT", DefaultEditorKit.previousWordAction, "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, "ctrl RIGHT", DefaultEditorKit.nextWordAction, "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, "ctrl A", DefaultEditorKit.selectAllAction, "HOME", DefaultEditorKit.beginLineAction, "END", DefaultEditorKit.endLineAction, "shift HOME", DefaultEditorKit.selectionBeginLineAction, "shift END", DefaultEditorKit.selectionEndLineAction, "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "ctrl H", DefaultEditorKit.deletePrevCharAction, "DELETE", DefaultEditorKit.deleteNextCharAction, "ctrl DELETE", DefaultEditorKit.deleteNextWordAction, "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction, "RIGHT", DefaultEditorKit.forwardAction, "LEFT", DefaultEditorKit.backwardAction, "KP_RIGHT", DefaultEditorKit.forwardAction, "KP_LEFT", DefaultEditorKit.backwardAction, "ENTER", JTextField.notifyAction, "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/, "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/ }); Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] { "ctrl C", DefaultEditorKit.copyAction, "ctrl V", DefaultEditorKit.pasteAction, "ctrl X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "control INSERT", DefaultEditorKit.copyAction, "shift INSERT", DefaultEditorKit.pasteAction, "shift DELETE", DefaultEditorKit.cutAction, "shift LEFT", DefaultEditorKit.selectionBackwardAction, "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, "shift RIGHT", DefaultEditorKit.selectionForwardAction, "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, "ctrl LEFT", DefaultEditorKit.beginLineAction, "ctrl KP_LEFT", DefaultEditorKit.beginLineAction, "ctrl RIGHT", DefaultEditorKit.endLineAction, "ctrl KP_RIGHT", DefaultEditorKit.endLineAction, "ctrl shift LEFT", DefaultEditorKit.selectionBeginLineAction, "ctrl shift KP_LEFT", DefaultEditorKit.selectionBeginLineAction, "ctrl shift RIGHT", DefaultEditorKit.selectionEndLineAction, "ctrl shift KP_RIGHT", DefaultEditorKit.selectionEndLineAction, "ctrl A", DefaultEditorKit.selectAllAction, "HOME", DefaultEditorKit.beginLineAction, "END", DefaultEditorKit.endLineAction, "shift HOME", DefaultEditorKit.selectionBeginLineAction, "shift END", DefaultEditorKit.selectionEndLineAction, "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "ctrl H", DefaultEditorKit.deletePrevCharAction, "DELETE", DefaultEditorKit.deleteNextCharAction, "RIGHT", DefaultEditorKit.forwardAction, "LEFT", DefaultEditorKit.backwardAction, "KP_RIGHT", DefaultEditorKit.forwardAction, "KP_LEFT", DefaultEditorKit.backwardAction, "ENTER", JTextField.notifyAction, "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/, "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/ }); Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] { "ctrl C", DefaultEditorKit.copyAction, "ctrl V", DefaultEditorKit.pasteAction, "ctrl X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "control INSERT", DefaultEditorKit.copyAction,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -