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

📄 component.java

📁 java virtual machince kaffe
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/** * Component - abstract root of all widgets * * Copyright (c) 1998 *      Transvirtual Technologies, Inc.  All rights reserved. * Copyright (c) 2006 *      Kaffe.org developers. See ChangeLog for details. * * See the file "license.terms" for information on usage and redistribution  * of this file.  * * original code P.C.Mehlitz * some code taken or adapted from Classpath */  package java.awt;import gnu.classpath.Pointer;import java.awt.event.ActionEvent;import java.awt.event.AdjustmentEvent;import java.awt.event.ComponentEvent;import java.awt.event.ComponentListener;import java.awt.event.ContainerEvent;import java.awt.event.FocusEvent;import java.awt.event.FocusListener;import java.awt.event.HierarchyBoundsListener;import java.awt.event.HierarchyEvent;import java.awt.event.HierarchyListener;import java.awt.event.InputMethodEvent;import java.awt.event.InputMethodListener;import java.awt.event.ItemEvent;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.awt.event.MouseWheelListener;import java.awt.event.MouseMotionListener;import java.awt.event.PaintEvent;import java.awt.event.TextEvent;import java.awt.event.WindowEvent;import java.awt.image.BufferStrategy;import java.awt.image.ColorModel;import java.awt.image.ImageObserver;import java.awt.image.ImageProducer;import java.awt.image.VolatileImage;import java.awt.peer.ComponentPeer;import java.awt.peer.LightweightPeer;import java.io.PrintStream;import java.io.PrintWriter;import java.io.Serializable;import java.lang.reflect.Array;import java.util.Collections;import java.util.EventListener;import java.util.HashSet;import java.util.Iterator;import java.util.Locale;import java.util.Set;import java.util.Vector;import java.awt.dnd.DropTarget;import java.beans.PropertyChangeListener;import java.beans.PropertyChangeSupport;import javax.accessibility.Accessible;import javax.accessibility.AccessibleComponent;import javax.accessibility.AccessibleContext;import javax.accessibility.AccessibleRole;import javax.accessibility.AccessibleState;import javax.accessibility.AccessibleStateSet;import org.kaffe.awt.DoNothingPeer;  abstract public class Component  extends Object  implements ImageObserver, MenuContainer, Serializable{	// We're not actually compatible with Sun's serialization format, so don't claim to be:	//final private static long serialVersionUID = -7644114512714619750L;	PopupMenu popup;	Rectangle deco = noDeco;	int flags = IS_VISIBLE;/** * linkedGraphs is a list of WeakReferences to NativeGraphics * objects, which is used to keep track of resident Graphics objects * for native-like Components (which we have to update in case * of a visibility or position change). See GraphicsLink for details */	GraphicsLink linkedGraphs;	final public static float TOP_ALIGNMENT = 0.0f;	final public static float CENTER_ALIGNMENT = 0.5f;	final public static float BOTTOM_ALIGNMENT = 1.0f;	final public static float LEFT_ALIGNMENT = 0.0f;	final public static float RIGHT_ALIGNMENT = 1.0f;	final static int BORDER_WIDTH = 2;	static Object treeLock = new TreeLock();	static Rectangle noDeco = new Rectangle();	final static int IS_VISIBLE = 0x01;	final static int IS_VALID = 0x02;	final static int IS_PARENT_SHOWING = 0x04;	final static int IS_LAYOUTING = 0x08;	final static int IS_IN_UPDATE = 0x10;	final static int IS_OLD_EVENT = 0x20;	final static int IS_RESIZABLE = 0x40;	final static int IS_MODAL = 0x80;	final static int IS_NATIVE_LIKE = 0x100;	final static int IS_OPENED = 0x200;	final static int IS_ADD_NOTIFIED = 0x400;	final static int IS_FG_COLORED = 0x800;	final static int IS_BG_COLORED = 0x1000;	final static int IS_FONTIFIED = 0x2000;	final static int IS_ASYNC_UPDATED = 0x4000;	final static int IS_DIRTY = 0x8000;	final static int IS_MOUSE_AWARE = 0x10000;	final static int IS_TEMP_HIDDEN = 0x20000;	final static int IS_SHOWING = IS_ADD_NOTIFIED | IS_PARENT_SHOWING | IS_VISIBLE;        /**            * The x position of the component in the parent's coordinate system.         *         * @see #getLocation()         * @serial the x position         */        int x;        /**            * The y position of the component in the parent's coordinate system.         *         * @see #getLocation()         * @serial the y position         */        int y;        /**            * The component width.         *         * @see #getSize()         * @serial the width         */        int width;        /**            * The component height.         *         * @see #getSize()         * @serial the height         */        int height;        /**            * The foreground color for the component. This may be null.         *         * @see #getForeground()         * @see #setForeground(Color)         * @serial the foreground color         */        Color foreground;        /**            * The background color for the component. This may be null.         *         * @see #getBackground()         * @see #setBackground(Color)         * @serial the background color         */        Color background;        /**            * The default font used in the component. This may be null.         *         * @see #getFont()         * @see #setFont(Font)         * @serial the font         */        Font font;        /**            * The font in use by the peer, or null if there is no peer.         *         * @serial the peer's font         */        Font peerFont;        /**            * The cursor displayed when the pointer is over this component. This may         * be null.         *         * @see #getCursor()         * @see #setCursor(Cursor)         */        Cursor cursor;        /**            * The locale for the component.         *         * @see #getLocale()         * @see #setLocale(Locale)         */        Locale locale = Locale.getDefault ();        /**            * True if the object should ignore repaint events (usually because it is                                                               * not showing).         *         * @see #getIgnoreRepaint()         * @see #setIgnoreRepaint(boolean)         * @serial true to ignore repaints         * @since 1.4         */        boolean ignoreRepaint;        /**            * True when the object is visible (although it is only showing if all                                               * ancestors are likewise visible). For component, this defaults to true.         *         * @see #isVisible()         * @see #setVisible(boolean)         * @serial true if visible         */        boolean visible = true;        /**            * True if the object is enabled, meaning it can interact with the user.         * For component, this defaults to true.         *         * @see #isEnabled()         * @see #setEnabled(boolean)         * @serial true if enabled         */        boolean enabled = true;        /**            * True if the object is valid. This is set to false any time a size         * adjustment means the component need to be layed out again.         *         * @see #isValid()         * @see #validate()         * @see #invalidate()         * @serial true if layout is valid         */        boolean valid;        /**            * The DropTarget for drag-and-drop operations.         *         * @see #getDropTarget()         * @see #setDropTarget(DropTarget)         * @serial the drop target, or null         * @since 1.2         */        DropTarget dropTarget;        /**            * The list of popup menus for this component.         *         * @see #add(PopupMenu)         * @serial the list of popups         */        Vector popups;        /**            * The component's name. May be null, in which case a default name is         * generated on the first use.         *         * @see #getName()         * @see #setName(String)         * @serial the name         */        String name;        /**            * True once the user has set the name. Note that the user may set the name         * to null.         *         * @see #name         * @see #getName()         * @see #setName(String)         * @serial true if the name has been explicitly set         */        boolean nameExplicitlySet;        /**            * Indicates if the object can be focused. Defaults to true for components.         *         * @see #isFocusable()         * @see #setFocusable(boolean)         * @since 1.4         */        boolean focusable = true;        /**            * Tracks whether this component's {@link #isFocusTraversable}         * method has been overridden.         *         * @since 1.4         */        int isFocusTraversableOverridden;        /**            * The focus traversal keys, if not inherited from the parent or         * default keyboard focus manager. These sets will contain only         * AWTKeyStrokes that represent press and release events to use as         * focus control.         *         * @see #getFocusTraversalKeys(int)         * @see #setFocusTraversalKeys(int, Set)         * @since 1.4         */        Set[] focusTraversalKeys;        /**            * True if focus traversal keys are enabled. This defaults to true for         * Component. If this is true, keystrokes in focusTraversalKeys are trapped         * and processed automatically rather than being passed on to the component.         *         * @see #getFocusTraversalKeysEnabled()         * @see #setFocusTraversalKeysEnabled(boolean)         * @since 1.4         */        boolean focusTraversalKeysEnabled = true;        /**            * Cached information on the minimum size. Should have been transient.         *         * @serial ignore         */        Dimension minSize;        /**            * Cached information on the preferred size. Should have been transient.         *         * @serial ignore         */        Dimension prefSize;        /**            * Set to true if an event is to be handled by this component, false if         * it is to be passed up the hierarcy.         *         * @see #dispatchEvent(AWTEvent)         * @serial true to process event locally         */        boolean newEventsOnly;        /**            * Set by subclasses to enable event handling of particular events, and         * left alone when modifying listeners. For component, this defaults to         * enabling only input methods.         *         * @see #enableInputMethods(boolean)         * @see AWTEvent         * @serial the mask of events to process         */        long eventMask = AWTEvent.INPUT_ENABLED_EVENT_MASK;        /**            * Describes all registered PropertyChangeListeners.         *         * @see #addPropertyChangeListener(PropertyChangeListener)         * @see #removePropertyChangeListener(PropertyChangeListener)         * @see #firePropertyChange(String, Object, Object)         * @serial the property change listeners         * @since 1.2         */        PropertyChangeSupport changeSupport;        /**            * True if the component has been packed (layed out).         *         * @serial true if this is packed         */        boolean isPacked;        /**            * The serialization version for this class. Currently at version 4.         *         * XXX How do we handle prior versions?         *         * @serial the serialization version         */        int componentSerializedDataVersion = 4;        /**            * The accessible context associated with this component. This is only set         * by subclasses.         *         * @see #getAccessibleContext()         * @serial the accessibility context         * @since 1.2         */        AccessibleContext accessibleContext;                // Guess what - listeners are special cased in serialization. See        // readObject and writeObject.        /** Component listener chain. */        transient ComponentListener componentListener;        /** Focus listener chain. */        transient FocusListener focusListener;        /** Key listener chain. */        transient KeyListener keyListener;        /** Mouse listener chain. */        transient MouseListener mouseListener;        /** Mouse motion listener chain. */        transient MouseMotionListener mouseMotionListener;        /**            * Mouse wheel listener chain.         *         * @since 1.4         */        transient MouseWheelListener mouseWheelListener;        /**            * Input method listener chain.         *         * @since 1.2         */        transient InputMethodListener inputMethodListener;        /**            * Hierarcy listener chain.         *         * @since 1.3         */        transient HierarchyListener hierarchyListener;        /**            * Hierarcy bounds listener chain.         *         * @since 1.3         */        transient HierarchyBoundsListener hierarchyBoundsListener;        /** The parent. */        transient Container parent;        /** The associated native peer. */        transient ComponentPeer peer;        /** The preferred component orientation. */        transient ComponentOrientation orientation = ComponentOrientation.UNKNOWN;

⌨️ 快捷键说明

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