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

📄 component.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
 */public boolean mouseUp(Event evt, int x, int y) {	return (false);}/** * @deprecated, use setLocation(int, int) */public void move(int x, int y) {	setBounds(x, y, width, height);}/** * @deprecated, use transferFocus() */public void nextFocus() {	transferFocus();}public void paint ( Graphics g ) {	// nothing to do here, that all has to be donw in subclasses}public void paintAll ( Graphics g ) {	paint( g);}void kaffePaintBorder () {	Graphics g = getGraphics();	if ( g != null ) {		kaffePaintBorder( g);		g.dispose();	}}void kaffePaintBorder ( Graphics g ) {	kaffePaintBorder( g, 0, 0, 0, 0);}void kaffePaintBorder ( Graphics g, int left, int top, int right, int bottom ) {	int w = width - (left + right);	int h = height - (top + bottom);	if ( this == AWTEvent.keyTgt )		g.setColor( Defaults.FocusClr);	else		g.setColor( Defaults.BorderClr);	if (w-1 > 0 && h-1 > 0) {		g.draw3DRect( left, top,  w-1, h-1, true);	}	if (w-3 > 0 && h-3 > 0) {		g.draw3DRect( left+1, top+1, w-3, h-3, false);	}}protected String paramString () {	String s = name + ',' + x + ',' + y + ',' + width + 'x' + height;		if ( !isValid() )   s += ",invalid";		if ( !isVisible() ) s += ",hidden";	if ( !isEnabled() ) s += ",disabled";		return s;}/** * @deprecated */public boolean postEvent ( Event evt ) {	if ( evt != null ) {		// travel all the way up in the parent chain until we find someone who handles it		for ( Component c = this; c != null; c = c.parent ) {			if ( c.handleEvent( evt) ) {				evt.recycle();				return (true);			}// Commented out since it doubles an event's x// and y coordinates with the Main example for java.awt.Component// from the Java Class Libraries book.//			    evt.x += c.x;//			    evt.y += c.y;		}				evt.recycle();	}	return (false);}/** * @deprecated - use getPreferredSize() */public Dimension preferredSize () {	// DEP - this should go into getPreferredSize (just here because of JDK compat)	// Huhh, a deprecated method calling a non-deprecated one?? But that's the	// way JDK obviously does it (just directly calling getMinimumSize)	return getMinimumSize();}public boolean prepareImage ( Image image, ImageObserver obs ){	return (prepareImage (image, -1, -1, obs));}public boolean prepareImage ( Image image, int width, int height, ImageObserver obs ) {	return (Image.loadImage( image, width, height, obs));}public void print ( Graphics g ) {}public void printAll ( Graphics g ) {}void process ( ActionEvent e ) {	// we don't know nothing about ActionEventListeners}void process ( AdjustmentEvent e ) {	// we don't know nothing about AdjustmentEventListeners}void process ( ComponentEvent e ) {	if ( (cmpListener != null) || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0)		processEvent( e);}void process ( ContainerEvent e ) {	// we don't know nothing about ContainerEventListeners}void process ( FocusEvent e ) {	if ( AWTEvent.focusHook != null ){		if ( AWTEvent.focusHook.intercept( e) )			return;	}	if ( (focusListener != null) || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0){		processEvent( e);	}		if ( (flags & IS_OLD_EVENT) != 0 ) postEvent( Event.getEvent( e));}void process ( ItemEvent e ) {	// we don't know nothing about ItemEventListeners}void process ( KeyEvent e ) {	if ( AWTEvent.keyHook != null ){		if ( AWTEvent.keyHook.intercept( e) )			return;	}	if ( (keyListener != null) || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0){		processEvent( e);	}	if ( (flags & IS_OLD_EVENT) != 0 ) postEvent( Event.getEvent( e));}void process ( TextEvent e ) {	// we don't know nothing about TextEventListeners}void process ( WindowEvent e ) {	// we don't know nothing about WindowEventListeners}protected void processActionEvent ( ActionEvent e ) {}protected void processAdjustmentEvent ( AdjustmentEvent e ) {}protected void processComponentEvent ( ComponentEvent event ) {	if ( cmpListener != null ){		switch ( event.getID() ) {		case ComponentEvent.COMPONENT_RESIZED:			cmpListener.componentResized( event);			break;		case ComponentEvent.COMPONENT_MOVED:			cmpListener.componentMoved( event);			break;		case ComponentEvent.COMPONENT_SHOWN:			cmpListener.componentShown( event);			break;		case ComponentEvent.COMPONENT_HIDDEN:			cmpListener.componentHidden( event);			break;		}	}}protected void processContainerEvent ( ContainerEvent e ) {}protected void processEvent ( AWTEvent e ) {	// Wasn't there something called "object oriented programming"?	// Would be nice if we could do a simple "e.dispatch()" (to rely on	// method overloading to do the branching), but we can't because this	// is a protected method, which constantly gets overloaded for modification	// of standard event processing (which is mostly silly because it can be done	// with listeners)	switch ( e.id ){	case MouseEvent.MOUSE_CLICKED:	//500..506	case MouseEvent.MOUSE_PRESSED:	case MouseEvent.MOUSE_RELEASED:	case MouseEvent.MOUSE_ENTERED:	case MouseEvent.MOUSE_EXITED:		// Not hard to anticipate that there will be AWT test suites throwing synthetic		// events against real components. However, this is "out of spec", most native window		// environments would act on the emitter side (rather than the responder), like we do		// (in MouseEvt). Moreover, processEvent() might be resolved by a derived class		// if ( (eventMask & AWTEvent.DISABLED_MASK) == 0 )		processMouseEvent( (MouseEvent)e);		break;			case MouseEvent.MOUSE_MOVED:	case MouseEvent.MOUSE_DRAGGED:		processMouseMotionEvent( (MouseEvent)e);		break;			case KeyEvent.KEY_TYPED:			//400..402	case KeyEvent.KEY_PRESSED:	case KeyEvent.KEY_RELEASED:		// if ( (eventMask & AWTEvent.DISABLED_MASK) == 0 )		processKeyEvent( (KeyEvent)e);		break;				case FocusEvent.FOCUS_GAINED:	//1004..1005	case FocusEvent.FOCUS_LOST:		processFocusEvent( (FocusEvent)e);		break;	case PaintEvent.PAINT:	case PaintEvent.UPDATE:		Rectangle r = ((PaintEvent)e).getUpdateRect();		processPaintEvent( e.id, r.x, r.y, r.width, r.height);		break;			case ComponentEvent.COMPONENT_MOVED:	//100..103	case ComponentEvent.COMPONENT_RESIZED:	case ComponentEvent.COMPONENT_SHOWN:	case ComponentEvent.COMPONENT_HIDDEN:		processComponentEvent( (ComponentEvent)e);		break;			case ContainerEvent.COMPONENT_ADDED:	//300..301	case ContainerEvent.COMPONENT_REMOVED:		processContainerEvent( (ContainerEvent)e);		break;			case WindowEvent.WINDOW_OPENED:			//200..206	case WindowEvent.WINDOW_CLOSING:	case WindowEvent.WINDOW_CLOSED:	case WindowEvent.WINDOW_ICONIFIED:	case WindowEvent.WINDOW_DEICONIFIED:	case WindowEvent.WINDOW_ACTIVATED:	case WindowEvent.WINDOW_DEACTIVATED:		processWindowEvent( (WindowEvent)e);		break;				case TextEvent.TEXT_VALUE_CHANGED:	//900		processTextEvent( (TextEvent)e);		break;				case ItemEvent.ITEM_STATE_CHANGED:	//701		processItemEvent( (ItemEvent)e);		break;				case ActionEvent.ACTION_PERFORMED:	//1001		processActionEvent( (ActionEvent)e);		break;				case AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED:	//601		processAdjustmentEvent( (AdjustmentEvent)e);		break;	}}protected void processFocusEvent ( FocusEvent event ) {	if ( focusListener != null ) {		switch ( event.getID() ) {		case FocusEvent.FOCUS_GAINED:			focusListener.focusGained( event);			break;		case FocusEvent.FOCUS_LOST:			focusListener.focusLost( event);			break;		}	}}protected void processItemEvent ( ItemEvent e ) {}protected void processKeyEvent ( KeyEvent event ) {	if ( keyListener != null ) {		switch ( event.id ) {		case KeyEvent.KEY_TYPED:			keyListener.keyTyped( event);			break;		case KeyEvent.KEY_PRESSED:			keyListener.keyPressed( event);			break;		case KeyEvent.KEY_RELEASED:			keyListener.keyReleased( event);			break;		}	}}void processMotion ( MouseEvent e ) {	if ( AWTEvent.mouseHook != null ){		if ( AWTEvent.mouseHook.intercept( e) )			return;	}	if ( (motionListener != null) || (eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0)		processEvent( e);	if ( (flags & IS_OLD_EVENT) != 0 ){		postEvent( Event.getEvent( e));	}}void processMouse ( MouseEvent e ) {	if ( AWTEvent.mouseHook != null ){		if ( AWTEvent.mouseHook.intercept( e) )			return;	}	if ( (mouseListener != null) || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0)		processEvent( e);	if ( (flags & IS_OLD_EVENT) != 0 ){		postEvent( Event.getEvent( e));	}}protected void processMouseEvent ( MouseEvent event ) {	if ( mouseListener != null ) {		switch ( event.id ) {			case MouseEvent.MOUSE_PRESSED:				mouseListener.mousePressed( event);				break;			case MouseEvent.MOUSE_RELEASED:				mouseListener.mouseReleased( event);				break;			case MouseEvent.MOUSE_CLICKED:				mouseListener.mouseClicked( event);				break;			case MouseEvent.MOUSE_EXITED:				mouseListener.mouseExited( event);				break;			case MouseEvent.MOUSE_ENTERED:				mouseListener.mouseEntered( event);				break;		}	}}protected void processMouseMotionEvent ( MouseEvent event ) {	if ( motionListener != null ) {		switch ( event.id ) {		case MouseEvent.MOUSE_MOVED:			motionListener.mouseMoved( event);			return;		case MouseEvent.MOUSE_DRAGGED:			motionListener.mouseDragged( event);			return;		}	}}void processPaintEvent ( int id, int ux, int uy, int uw, int uh ) {	NativeGraphics g = NativeGraphics.getClippedGraphics( null, this, 0,0,	                                                      ux, uy, uw, uh,	                                                      false);	if ( g != null ){		if ( id == PaintEvent.UPDATE )			update( g);		else			paint( g);		g.dispose();	}}protected void processTextEvent ( TextEvent e ) {}protected void processWindowEvent ( WindowEvent e ) {}void propagateBgClr ( Color clr ) {	// should be called *only* on Components with unset IS_BG_COLORED	bgClr = clr;}void propagateFgClr ( Color clr ) {	// should be called *only* on Components with unset IS_FG_COLORED	fgClr = clr;}void propagateFont ( Font fnt ) {	// should be called *only* on Components with unset IS_FONTIFIED	font = fnt;}void propagateParentShowing ( boolean isTemporary) {	// no kids, we don't have to propagate anything		// but we might have resident Graphics which have to be notified	if ( !isTemporary ) {		if ( linkedGraphs != null )			updateLinkedGraphics();	}}void propagateReshape () {	// no kids, we don't have to propagate anything		// but we might have resident Graphics which have to be notified	if ( linkedGraphs != null )		updateLinkedGraphics();}void propagateTempEnabled ( boolean isEnabled ) {	if ( isEnabled) {		if ( (eventMask & AWTEvent.TEMP_DISABLED_MASK) != 0 ) 			eventMask &= ~(AWTEvent.DISABLED_MASK | AWTEvent.TEMP_DISABLED_MASK);	}	else {		if ( (eventMask & AWTEvent.DISABLED_MASK) == 0 )			eventMask |= (AWTEvent.DISABLED_MASK | AWTEvent.TEMP_DISABLED_MASK);	}		checkMouseAware();}public void remove( MenuComponent mc) {	mc.removeNotify();	mc.parent = null;	mc.owner = null;		if ( popup != null)		popup.remove( mc);}public void removeComponentListener ( ComponentListener client ) {	cmpListener = AWTEventMulticaster.remove( cmpListener, client);}public void removeFocusListener ( FocusListener listener ) {	focusListener = AWTEventMulticaster.remove( focusListener, listener);}public void removeKeyListener ( KeyListener listener ) {	keyListener = AWTEventMulticaster.remove( keyListener, listener);}public void removeMouseListener ( MouseListener listener ) {	mouseListener = AWTEventMulticaster.remove( mouseListener, listener);		checkMouseAware();}public void removeMouseMotionListener ( MouseMotionListener listener ) {	motionListener = AWTEventMulticaster.remove( motionListener, listener);		checkMouseAware();}public void removeNotify () {	flags &= ~IS_ADD_NOTIFIED;	if ( popup != null ) {		popup.removeNotify();	}	// the inflight video program will be ceased by now, clean up any	// leftover global state (remember: removeNotify can be called anywhere, anytime)

⌨️ 快捷键说明

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