⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tab.java

📁 eclipse中
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	 * 	 * @return an array containing custom event names	 */	String [] getCustomEventNames () {		return new String [0];	}		/**	 * Gets the default style for a widget	 *	 * @return the default style bit	 */	int getDefaultStyle () {		if (ltrButton != null && ltrButton.getSelection()) {			return SWT.LEFT_TO_RIGHT;		}		if (rtlButton != null && rtlButton.getSelection()) {			return SWT.RIGHT_TO_LEFT;		}		return SWT.NONE;	}		/**	 * Gets the "Example" widget children.	 *	 * @return an array containing the example widget children	 */	Control [] getExampleWidgets () {		return new Control [0];	}		/**	 * Gets the "Example" widget children's items, if any.	 *	 * @return an array containing the example widget children's items	 */	Item [] getExampleWidgetItems () {		return new Item [0];	}		/**	 * Gets the text for the tab folder item.	 *	 * @return the text for the tab item	 */	String getTabText () {		return "";	}		/**	 * Hooks all listeners to all example controls	 * and example control items.	 */	void hookExampleWidgetListeners () {		if (logging) {			Control[] exampleControls = getExampleWidgets ();			for (int i = 0; i < exampleControls.length; i++) {				hookListeners (exampleControls [i]);			}			Item[] exampleItems = getExampleWidgetItems ();			for (int i = 0; i < exampleItems.length; i++) {				hookListeners (exampleItems [i]);			}			String [] customNames = getCustomEventNames ();			for (int i = 0; i < customNames.length; i++) {				if (eventsFilter [EVENT_NAMES.length + i]) hookCustomListener (customNames[i]);			}		}	}		/**	 * Hooks the custom listener specified by eventName.	 */	void hookCustomListener (String eventName) {	}		/**	 * Hooks all listeners to the specified widget.	 */	void hookListeners (Widget widget) {		if (logging) {			Listener listener = new Listener() {				public void handleEvent (Event event) {					log (event);				}			};			for (int i = 0; i < EVENT_NAMES.length; i++) {				if (eventsFilter [i]) widget.addListener (i + 1, listener);			}		}	}		/**	 * Logs an untyped event to the event console.	 */	void log(Event event) {		String toString = EVENT_NAMES[event.type - 1] + ": ";		switch (event.type) {			case SWT.KeyDown:			case SWT.KeyUp: toString += new KeyEvent (event).toString (); break;			case SWT.MouseDown:			case SWT.MouseUp:			case SWT.MouseMove:			case SWT.MouseEnter:			case SWT.MouseExit:			case SWT.MouseDoubleClick:			case SWT.MouseHover: toString += new MouseEvent (event).toString (); break;			case SWT.Paint: toString += new PaintEvent (event).toString (); break;			case SWT.Move:			case SWT.Resize: toString += new ControlEvent (event).toString (); break;			case SWT.Dispose: toString += new DisposeEvent (event).toString (); break;			case SWT.Selection:			case SWT.DefaultSelection: toString += new SelectionEvent (event).toString (); break;			case SWT.FocusIn:			case SWT.FocusOut: toString += new FocusEvent (event).toString (); break;			case SWT.Expand:			case SWT.Collapse: toString += new TreeEvent (event).toString (); break;			case SWT.Iconify:			case SWT.Deiconify:			case SWT.Close:			case SWT.Activate:			case SWT.Deactivate: toString += new ShellEvent (event).toString (); break;			case SWT.Show:			case SWT.Hide: toString += (event.widget instanceof Menu) ? new MenuEvent (event).toString () : event.toString(); break;			case SWT.Modify: toString += new ModifyEvent (event).toString (); break;			case SWT.Verify: toString += new VerifyEvent (event).toString (); break;			case SWT.Help: toString += new HelpEvent (event).toString (); break;			case SWT.Arm: toString += new ArmEvent (event).toString (); break;			case SWT.Traverse: toString += new TraverseEvent (event).toString (); break;			case SWT.HardKeyDown:			case SWT.HardKeyUp:			case SWT.DragDetect:			case SWT.MenuDetect:			default: toString += event.toString ();		}		eventConsole.append (toString);		eventConsole.append ("\n");	}	/**	 * Logs a typed event to the event console.	 */	void log (String eventName, TypedEvent event) {		eventConsole.append (eventName + ": ");		eventConsole.append (event.toString ());		eventConsole.append ("\n");	}		/**	 * Recreates the "Example" widgets.	 */	void recreateExampleWidgets () {		disposeExampleWidgets ();		createExampleWidgets ();		hookExampleWidgetListeners ();		setExampleWidgetState ();	}		/**	 * Sets the foreground color, background color, and font	 * of the "Example" widgets to their default settings.	 * Subclasses may extend in order to reset other colors	 * and fonts to default settings as well.	 */	void resetColorsAndFonts () {		Color oldColor = foregroundColor;		foregroundColor = null;		setExampleWidgetForeground ();		if (oldColor != null) oldColor.dispose();		oldColor = backgroundColor;		backgroundColor = null;		setExampleWidgetBackground ();		if (oldColor != null) oldColor.dispose();		Font oldFont = font;		font = null;		setExampleWidgetFont ();		setExampleWidgetSize ();		if (oldFont != null) oldFont.dispose();	}		/**	 * Sets the background color of the "Example" widgets.	 */	void setExampleWidgetBackground () {		if (backgroundButton == null) return; // no background button on this tab		Control [] controls = getExampleWidgets ();		for (int i = 0; i < controls.length; i++) {			controls[i].setBackground (backgroundColor);		}		// Set the background button's color to match the color just set.		Color color = backgroundColor;		if (controls.length == 0) return;		if (color == null) color = controls [0].getBackground ();		drawImage (backgroundImage, color);		backgroundButton.setImage (backgroundImage);	}		/**	 * Sets the enabled state of the "Example" widgets.	 */	void setExampleWidgetEnabled () {		Control [] controls = getExampleWidgets ();		for (int i=0; i<controls.length; i++) {			controls [i].setEnabled (enabledButton.getSelection ());		}	}		/**	 * Sets the font of the "Example" widgets.	 */	void setExampleWidgetFont () {		if (instance.startup) return;		if (fontButton == null) return; // no font button on this tab		Control [] controls = getExampleWidgets ();		for (int i = 0; i < controls.length; i++) {			Control control = controls[i];			control.setFont(font);		}	}		/**	 * Sets the foreground color of the "Example" widgets.	 */	void setExampleWidgetForeground () {		if (foregroundButton == null) return; // no foreground button on this tab		Control [] controls = getExampleWidgets ();		for (int i = 0; i < controls.length; i++) {			controls[i].setForeground (foregroundColor);		}		// Set the foreground button's color to match the color just set.		Color color = foregroundColor;		if (controls.length == 0) return;		if (color == null) color = controls [0].getForeground ();		drawImage (foregroundImage, color);		foregroundButton.setImage (foregroundImage);	}		/**	 * Sets the size of the "Example" widgets.	 */	void setExampleWidgetSize () {		int size = SWT.DEFAULT;		if (preferredButton == null) return;		if (preferredButton.getSelection()) size = SWT.DEFAULT;		if (tooSmallButton.getSelection()) size = TOO_SMALL_SIZE;		if (smallButton.getSelection()) size = SMALL_SIZE;		if (largeButton.getSelection()) size = LARGE_SIZE;		Control [] controls = getExampleWidgets ();		for (int i=0; i<controls.length; i++) {			GridData gridData; 			if (fillButton.getSelection()) {				gridData = new GridData (GridData.FILL_BOTH);			} else {				gridData = new GridData ();				gridData.widthHint = size;				gridData.heightHint = size;			}			controls [i].setLayoutData (gridData);		}		/*		 * Force the entire widget tree to layout,		 * even when the child sizes may not have		 * changed.		 */		int seenCount = 0;		Composite [] seen = new Composite [4];		for (int i=0; i<controls.length; i++) {			Control control = controls [i];			while (control != exampleGroup) {				Composite parent = control.getParent ();				int index = 0;				while (index < seenCount) {					if (seen [index] == parent) break;					index++;				}				if (index == seenCount) parent.layout ();				if (seenCount == seen.length) {					Composite [] newSeen = new Composite [seen.length + 4];					System.arraycopy (seen, 0, newSeen, 0, seen.length);					seen = newSeen;				}				seen [seenCount++] = parent;				control = control.getParent ();			}		}	}		/**	 * Sets the state of the "Example" widgets.  Subclasses	 * reimplement this method to set "Example" widget state	 * that is specific to the widget.	 */	void setExampleWidgetState () {		setExampleWidgetEnabled ();		setExampleWidgetVisibility ();		setExampleWidgetBackground ();		setExampleWidgetForeground ();		setExampleWidgetFont ();		setExampleWidgetSize ();	}		/**	 * Sets the visibility of the "Example" widgets.	 */	void setExampleWidgetVisibility () {		Control [] controls = getExampleWidgets ();		for (int i=0; i<controls.length; i++) {			controls [i].setVisible (visibleButton.getSelection ());		}	}}

⌨️ 快捷键说明

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