📄 basiclookandfeel.java
字号:
/* BasicLookAndFeel.java -- Copyright (C) 2002 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING. If not, write to theFree Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library. Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule. An independent module is a module which is not derived fromor based on this library. If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so. If you do not wish to do so, delete thisexception statement from your version. */package javax.swing.plaf.basic;import java.awt.Color;import java.awt.Dimension;import java.awt.Font;import java.awt.event.KeyEvent;import java.io.Serializable;import java.util.Enumeration;import java.util.ResourceBundle;import javax.swing.ImageIcon;import javax.swing.KeyStroke;import javax.swing.LookAndFeel;import javax.swing.UIDefaults;import javax.swing.plaf.BorderUIResource;import javax.swing.plaf.ColorUIResource;import javax.swing.plaf.DimensionUIResource;import javax.swing.plaf.FontUIResource;import javax.swing.plaf.IconUIResource;import javax.swing.plaf.InsetsUIResource;import javax.swing.text.JTextComponent;/** * BasicLookAndFeel * @author Andrew Selkirk */public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable{ /** * Constructor BasicLookAndFeel */ public BasicLookAndFeel() { // TODO } /** * getDefaults * @return UIDefaults */ public UIDefaults getDefaults() { // Variables UIDefaults def = new UIDefaults(); // Initialize Class Defaults initClassDefaults(def); // Initialize System Colour Defaults initSystemColorDefaults(def); // Initialize Component Defaults initComponentDefaults(def); // Return UI Defaults return def; } /** * initClassDefaults * @param value0 TODO */ protected void initClassDefaults(UIDefaults defaults) { // Variables Object[] uiDefaults; // Initialize Class Defaults uiDefaults = new Object[] { "ButtonUI", "javax.swing.plaf.basic.BasicButtonUI", "CheckBoxMenuItemUI", "javax.swing.plaf.basic.BasicCheckBoxMenuItemUI", "CheckBoxUI", "javax.swing.plaf.basic.BasicCheckBoxUI", "ColorChooserUI", "javax.swing.plaf.basic.BasicColorChooserUI", "ComboBoxUI", "javax.swing.plaf.basic.BasicComboBoxUI", "DesktopIconUI", "javax.swing.plaf.basic.BasicDesktopIconUI", "DesktopPaneUI", "javax.swing.plaf.basic.BasicDesktopPaneUI", "EditorPaneUI", "javax.swing.plaf.basic.BasicEditorPaneUI", "InternalFrameUI", "javax.swing.plaf.basic.BasicInternalFrameUI", "LabelUI", "javax.swing.plaf.basic.BasicLabelUI", "ListUI", "javax.swing.plaf.basic.BasicListUI", "MenuBarUI", "javax.swing.plaf.basic.BasicMenuBarUI", "MenuItemUI", "javax.swing.plaf.basic.BasicMenuItemUI", "MenuUI", "javax.swing.plaf.basic.BasicMenuUI", "OptionPaneUI", "javax.swing.plaf.basic.BasicOptionPaneUI", "PanelUI", "javax.swing.plaf.basic.BasicPanelUI", "PasswordFieldUI", "javax.swing.plaf.basic.BasicPasswordFieldUI", "PopupMenuSeparatorUI", "javax.swing.plaf.basic.BasicPopupMenuSeparatorUI", "PopupMenuUI", "javax.swing.plaf.basic.BasicPopupMenuUI", "ProgressBarUI", "javax.swing.plaf.basic.BasicProgressBarUI", "RadioButtonMenuItemUI", "javax.swing.plaf.basic.BasicRadioButtonMenuItemUI", "RadioButtonUI", "javax.swing.plaf.basic.BasicRadioButtonUI", "RootPaneUI", "javax.swing.plaf.basic.BasicRootPaneUI", "ScrollBarUI", "javax.swing.plaf.basic.BasicScrollBarUI", "ScrollPaneUI", "javax.swing.plaf.basic.BasicScrollPaneUI", "SeparatorUI", "javax.swing.plaf.basic.BasicSeparatorUI", "SliderUI", "javax.swing.plaf.basic.BasicSliderUI", "SplitPaneUI", "javax.swing.plaf.basic.BasicSplitPaneUI", "StandardDialogUI", "javax.swing.plaf.basic.BasicStandardDialogUI", "TabbedPaneUI", "javax.swing.plaf.basic.BasicTabbedPaneUI", "TableHeaderUI", "javax.swing.plaf.basic.BasicTableHeaderUI", "TableUI", "javax.swing.plaf.basic.BasicTableUI", "TextAreaUI", "javax.swing.plaf.basic.BasicTextAreaUI", "TextFieldUI", "javax.swing.plaf.basic.BasicTextFieldUI", "TextPaneUI", "javax.swing.plaf.basic.BasicTextPaneUI", "ToggleButtonUI", "javax.swing.plaf.basic.BasicToggleButtonUI", "ToolBarSeparatorUI", "javax.swing.plaf.basic.BasicToolBarSeparatorUI", "ToolBarUI", "javax.swing.plaf.basic.BasicToolBarUI", "ToolTipUI", "javax.swing.plaf.basic.BasicToolTipUI", "TreeUI", "javax.swing.plaf.basic.BasicTreeUI", "ViewportUI", "javax.swing.plaf.basic.BasicViewportUI" }; // Add Class Defaults to UI Defaults table defaults.putDefaults(uiDefaults); } /** * initSystemColorDefaults * @param defaults TODO */ protected void initSystemColorDefaults(UIDefaults defaults) { Object[] uiDefaults; uiDefaults = new Object[] { "activeCaption", new ColorUIResource(0, 0, 128), "activeCaptionBorder", new ColorUIResource(Color.lightGray), "activeCaptionText", new ColorUIResource(Color.white), "control", new ColorUIResource(Color.lightGray), "controlDkShadow", new ColorUIResource(Color.black), "controlHighlight", new ColorUIResource(Color.lightGray), "controlLtHighlight", new ColorUIResource(Color.white), "controlShadow", new ColorUIResource(Color.gray), "controlText", new ColorUIResource(Color.black), "desktop", new ColorUIResource(0, 92, 92), "inactiveCaption", new ColorUIResource(Color.gray), "inactiveCaptionBorder", new ColorUIResource(Color.lightGray), "inactiveCaptionText", new ColorUIResource(Color.lightGray), "info", new ColorUIResource(Color.white), "infoText", new ColorUIResource(Color.black), "menu", new ColorUIResource(Color.lightGray), "menuText", new ColorUIResource(Color.black), "scrollbar", new ColorUIResource(224, 224, 224), "text", new ColorUIResource(Color.lightGray), "textHighlight", new ColorUIResource(0, 0, 128), "textHighlightText", new ColorUIResource(Color.white), "textInactiveText", new ColorUIResource(Color.gray), "textText", new ColorUIResource(Color.black), "window", new ColorUIResource(Color.white), "windowBorder", new ColorUIResource(Color.black), "windowText", new ColorUIResource(Color.black) }; defaults.putDefaults(uiDefaults); } /** * loadSystemColors * @param defaults TODO * @param value1 TODO * @param value2 TODO */ protected void loadSystemColors(UIDefaults defaults, String[] value1, boolean value2) { // TODO } /** * loadResourceBundle * @param defaults TODO */ private void loadResourceBundle(UIDefaults defaults) { ResourceBundle bundle; Enumeration enum; String key; String value; bundle = ResourceBundle.getBundle("resources/basic"); // Process Resources enum = bundle.getKeys(); while (enum.hasMoreElements()) { key = (String) enum.nextElement(); value = bundle.getString(key); defaults.put(key, value); } } /** * initComponentDefaults * @param defaults TODO */ protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; uiDefaults = new Object[] { "Button.background", new ColorUIResource(Color.lightGray), "Button.border", new BorderUIResource.CompoundBorderUIResource(null, null), "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -