windowslookandfeel.java

来自「JAVA 所有包」· Java 代码 · 共 1,352 行 · 第 1/5 页

JAVA
1,352
字号
              "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */                   "info", "#FFFFE1", /* ??? */               "infoText", "#000000"  /* ??? */        };        loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());    }   /**     * Initialize the defaults table with the name of the ResourceBundle     * used for getting localized defaults.     */    private void initResourceBundle(UIDefaults table) {        table.addResourceBundle( "com.sun.java.swing.plaf.windows.resources.windows" );    }    // XXX - there are probably a lot of redundant values that could be removed.     // ie. Take a look at RadioButtonBorder, etc...    protected void initComponentDefaults(UIDefaults table)     {        super.initComponentDefaults( table );        initResourceBundle(table);        // *** Shared Fonts	Integer twelve = new Integer(12);	Integer eight = new Integer(8);	Integer ten = new Integer(10);	Integer fontPlain = new Integer(Font.PLAIN);	Integer fontBold = new Integer(Font.BOLD);	Object dialogPlain12 = new SwingLazyValue(			       "javax.swing.plaf.FontUIResource",			       null,			       new Object[] {Font.DIALOG, fontPlain, twelve});	Object sansSerifPlain12 =  new SwingLazyValue(			  "javax.swing.plaf.FontUIResource",			  null,			  new Object[] {Font.SANS_SERIF, fontPlain, twelve});	Object monospacedPlain12 = new SwingLazyValue(			  "javax.swing.plaf.FontUIResource",			  null,			  new Object[] {Font.MONOSPACED, fontPlain, twelve});	Object dialogBold12 = new SwingLazyValue(			  "javax.swing.plaf.FontUIResource",			  null,			  new Object[] {Font.DIALOG, fontBold, twelve});        // *** Colors	// XXX - some of these doens't seem to be used        ColorUIResource red = new ColorUIResource(Color.red);        ColorUIResource black = new ColorUIResource(Color.black);        ColorUIResource white = new ColorUIResource(Color.white);        ColorUIResource yellow = new ColorUIResource(Color.yellow);        ColorUIResource gray = new ColorUIResource(Color.gray);        ColorUIResource lightGray = new ColorUIResource(Color.lightGray);        ColorUIResource darkGray = new ColorUIResource(Color.darkGray);        ColorUIResource scrollBarTrack = lightGray;        ColorUIResource scrollBarTrackHighlight = darkGray;	// Set the flag which determines which version of Windows should	// be rendered. This flag only need to be set once.	// if version <= 4.0 then the classic LAF should be loaded.	String osVersion = System.getProperty("os.version");	if (osVersion != null) {	    try {		Float version = Float.valueOf(osVersion);		if (version.floatValue() <= 4.0) {		    isClassicWindows = true;		} else {		    isClassicWindows = false;		}	    } catch (NumberFormatException ex) {		isClassicWindows = false;	    }	}        // *** Tree         ColorUIResource treeSelection = new ColorUIResource(0, 0, 128);        Object treeExpandedIcon = WindowsTreeUI.ExpandedIcon.createExpandedIcon();        Object treeCollapsedIcon = WindowsTreeUI.CollapsedIcon.createCollapsedIcon();	// *** Text	Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {	              "control C", DefaultEditorKit.copyAction,	              "control V", DefaultEditorKit.pasteAction,                      "control X", DefaultEditorKit.cutAction,			   "COPY", DefaultEditorKit.copyAction,			  "PASTE", DefaultEditorKit.pasteAction,			    "CUT", DefaultEditorKit.cutAction,                 "control INSERT", DefaultEditorKit.copyAction,                   "shift INSERT", DefaultEditorKit.pasteAction,                   "shift DELETE", DefaultEditorKit.cutAction,	    	              "control A", DefaultEditorKit.selectAllAction,	     "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,	             "shift LEFT", DefaultEditorKit.selectionBackwardAction,	            "shift RIGHT", DefaultEditorKit.selectionForwardAction,	           "control LEFT", DefaultEditorKit.previousWordAction,	          "control RIGHT", DefaultEditorKit.nextWordAction,	     "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,	                   "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,                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/	});        Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] {                      "control C", DefaultEditorKit.copyAction,                      "control V", DefaultEditorKit.pasteAction,                      "control X", DefaultEditorKit.cutAction,                           "COPY", DefaultEditorKit.copyAction,                          "PASTE", DefaultEditorKit.pasteAction,                            "CUT", DefaultEditorKit.cutAction,                 "control INSERT", DefaultEditorKit.copyAction,                   "shift INSERT", DefaultEditorKit.pasteAction,                   "shift DELETE", DefaultEditorKit.cutAction,                      "control A", DefaultEditorKit.selectAllAction,             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,                   "control LEFT", DefaultEditorKit.beginLineAction,                  "control RIGHT", DefaultEditorKit.endLineAction,             "control shift LEFT", DefaultEditorKit.selectionBeginLineAction,            "control shift RIGHT", DefaultEditorKit.selectionEndLineAction,                           "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,                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/        });	Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {		      "control C", DefaultEditorKit.copyAction,		      "control V", DefaultEditorKit.pasteAction,		      "control 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 RIGHT", DefaultEditorKit.selectionForwardAction,		   "control LEFT", DefaultEditorKit.previousWordAction,		  "control RIGHT", DefaultEditorKit.nextWordAction,	     "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,	    "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,		      "control A", DefaultEditorKit.selectAllAction,	     "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,			   "HOME", DefaultEditorKit.beginLineAction,			    "END", DefaultEditorKit.endLineAction,		     "shift HOME", DefaultEditorKit.selectionBeginLineAction,		      "shift END", DefaultEditorKit.selectionEndLineAction,		   "control HOME", DefaultEditorKit.beginAction,		    "control END", DefaultEditorKit.endAction,	     "control shift HOME", DefaultEditorKit.selectionBeginAction,	      "control shift END", DefaultEditorKit.selectionEndAction,			     "UP", DefaultEditorKit.upAction,			   "DOWN", DefaultEditorKit.downAction,                     "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,			"PAGE_UP", DefaultEditorKit.pageUpAction,		      "PAGE_DOWN", DefaultEditorKit.pageDownAction,		  "shift PAGE_UP", "selection-page-up", 	        "shift PAGE_DOWN", "selection-page-down",	     "ctrl shift PAGE_UP", "selection-page-left", 	   "ctrl shift PAGE_DOWN", "selection-page-right",		       "shift UP", DefaultEditorKit.selectionUpAction,		     "shift DOWN", DefaultEditorKit.selectionDownAction,			  "ENTER", DefaultEditorKit.insertBreakAction,			    "TAB", DefaultEditorKit.insertTabAction,                      "control T", "next-link-action",                "control shift T", "previous-link-action",                  "control SPACE", "activate-link-action",                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/	});	Object menuItemAcceleratorDelimiter = new String("+");	Object ControlBackgroundColor = new DesktopProperty(                                                       "win.3d.backgroundColor", 						        table.get("control"),                                                       toolkit);	Object ControlLightColor      = new DesktopProperty(                                                       "win.3d.lightColor", 							table.get("controlHighlight"),                                                       toolkit);	Object ControlHighlightColor  = new DesktopProperty(                                                       "win.3d.highlightColor", 							table.get("controlLtHighlight"),                                                       toolkit);	Object ControlShadowColor     = new DesktopProperty(                                                       "win.3d.shadowColor", 							table.get("controlShadow"),                                                       toolkit);	Object ControlDarkShadowColor = new DesktopProperty(                                                       "win.3d.darkShadowColor", 							table.get("controlDkShadow"),                                                       toolkit);	Object ControlTextColor       = new DesktopProperty(                                                       "win.button.textColor", 							table.get("controlText"),                                                       toolkit);	Object MenuBackgroundColor    = new DesktopProperty(                                                       "win.menu.backgroundColor", 							table.get("menu"),                                                       toolkit);	Object MenuBarBackgroundColor = new DesktopProperty(                                                       "win.menubar.backgroundColor", 							table.get("menu"),                                                       toolkit);	Object MenuTextColor          = new DesktopProperty(                                                       "win.menu.textColor", 							table.get("menuText"),                                                       toolkit);	Object SelectionBackgroundColor = new DesktopProperty(                                                       "win.item.highlightColor", 							table.get("textHighlight"),                                                       toolkit);	Object SelectionTextColor     = new DesktopProperty(                                                       "win.item.highlightTextColor", 							table.get("textHighlightText"),                                                       toolkit);	Object WindowBackgroundColor  = new DesktopProperty(                                                       "win.frame.backgroundColor", 							table.get("window"),                                                       toolkit);	Object WindowTextColor        = new DesktopProperty(                                                       "win.frame.textColor", 							table.get("windowText"),                                                       toolkit);        Object WindowBorderWidth      = new DesktopProperty(                                                       "win.frame.sizingBorderWidth",                                                       new Integer(1),                                                       toolkit);        Object TitlePaneHeight        = new DesktopProperty(                                                       "win.frame.captionHeight",                                                       new Integer(18),

⌨️ 快捷键说明

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