windowslookandfeel.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 1,348 行 · 第 1/5 页

JAVA
1,348
字号
	Object dialogPlain12 = new SwingLazyValue(			       "javax.swing.plaf.FontUIResource",			       null,			       new Object[] {"Dialog", fontPlain, twelve});	Object sansSerifPlain12 =  new SwingLazyValue(			  "javax.swing.plaf.FontUIResource",			  null,			  new Object[] {"SansSerif", fontPlain, twelve});	Object monospacedPlain12 = new SwingLazyValue(			  "javax.swing.plaf.FontUIResource",			  null,			  new Object[] {"MonoSpaced", fontPlain, twelve});	Object dialogBold12 = new SwingLazyValue(			  "javax.swing.plaf.FontUIResource",			  null,			  new Object[] {"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,                         "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 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,                         "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,                         "ctrl H", DefaultEditorKit.deletePrevCharAction,                         "DELETE", DefaultEditorKit.deleteNextCharAction,                          "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),                                                       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);        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 MenuFont = dialogPlain12;        Object FixedControlFont = monospacedPlain12;        Object ControlFont = dialogPlain12;        Object MessageFont = dialogPlain12;        Object WindowFont = dialogBold12;        Object ToolTipFont = sansSerifPlain12;	Object IconFont = ControlFont;

⌨️ 快捷键说明

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