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

📄 component.java

📁 This is a resource based on j2me embedded,if you dont understand,you can connection with me .
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* * @(#)Component.java	1.53 06/10/10 * * Copyright  1990-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER *  * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation.  *  * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt).  *  * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA  *  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions.  * */package java.awt;import java.io.PrintStream;import java.io.PrintWriter;import java.util.Vector;import java.util.Locale;import java.util.EventListener;import java.util.Timer;import java.util.TimerTask;import java.awt.im.InputContext;import java.awt.im.InputMethodRequests;import java.awt.image.ImageObserver;import java.awt.image.ImageProducer;import java.awt.image.ColorModel;import java.awt.image.VolatileImage;import java.awt.event.*;import java.io.Serializable;import java.io.ObjectOutputStream;import java.io.ObjectInputStream;import java.io.IOException;import java.beans.PropertyChangeListener;import java.security.AccessController;import sun.awt.NullGraphics;import sun.awt.ConstrainableGraphics;import sun.awt.AppContext;import sun.awt.SunToolkit;import sun.security.action.GetPropertyAction;import java.util.Set;import java.util.Iterator;import java.util.HashSet;import java.util.Collections;/** * A <em>component</em> is an object having a graphical representation * that can be displayed on the screen and that can interact with the * user. Examples of components are the buttons, checkboxes, and scrollbars * of a typical graphical user interface. <p> * The <code>Component</code> class is the abstract superclass of * the nonmenu-related Abstract Window Toolkit components. Class * <code>Component</corede> can also be extended directly to create a * lightweight component. A lightweight component is a component that is * not associated with a native opaque window. * * <p> * <a name="restrictions"> * <h4>Restrictions</h4> * <em> * Implementations of Component in Personal Basis Profile exhibit * certain restrictions, specifically: * <ul> * <li> An implementation may prohibit setting the cursor.  In such * a case, attempts to set the cursor will fail silently. * See: * <ul> * <li> {@link #setCursor} * </ul> * </ul> * </em> * @version 1.11, 01/16/02 * @author Nicholas Allen */public abstract class Component implements ImageObserver,        Serializable {    /**     * The parent of the object. It may be null for top-level components.     * @see #getParent     */    transient Container parent;    /**     * The x position of the component in the parent's coordinate system.     *     * @serial     * @see #getLocation     */    int x;    /**     * The y position of the component in the parent's coordinate system.     *     * @serial     * @see #getLocation     */    int y;    /**     * The width of the component.     *     * @serial     * @see #getSize     */    int width;    /**     * The height of the component.     *     * @serial     * @see #getSize     */    int height;    /**     * The foreground color for this component.     * foreground color can be null.     *     * @serial     * @see #getForeground     * @see #setForeground     */    Color	foreground;    /**     * The background color for this component.     * background can be null.     *     * @serial     * @see #getBackground     * @see #setBackground     */    Color	background;    /**     * The font used by this component.     * The font can be null.     *     * @serial     * @see #getFont     * @see #setFont     */    Font	font;    /**     * The cursor displayed when pointer is over this component.     * This value can be null.     *     * @serial     * @see #getCursor     * @see #setCursor     */    Cursor	cursor;    /**     * The locale for the component.     *     * @serial     * @see #getLocale     * @see #setLocale     */    Locale      locale;    /**     * A reference to a GraphicsConfiguration object     * used to describe the characteristics of a graphics     * destination.     * This value can be null.     *     * @since 1.3     * @serial     * @see java.awt.GraphicsConfiguration     * @see #getGraphicsConfiguration     */    //transient GraphicsConfiguration graphicsConfig = null;    // ### Serialization difference    // No field GraphicsConfiguration graphicsConfig    /**     * True when the object should ignore all repaint events.     *     * @since 1.4     * @serial     * @see #setIgnoreRepaint     * @see #getIgnoreRepaint     */    boolean ignoreRepaint = false;    /**     * True when the object is visible. An object that is not     * visible is not drawn on the screen.     *     * @serial     * @see #isVisible     * @see #setVisible     */    boolean visible = true;    /**     * True when the object is enabled. An object that is not     * enabled does not interact with the user.     *     * @serial     * @see #isEnabled     * @see #setEnabled     */    boolean enabled = true;    /**     * True when the object is displayable. This field is necessary     * because peers are not used in basis profile.     *     * @see #isDisplayable     */    transient boolean displayable;    /**     * True when the object is valid. An invalid object needs to     * be layed out. This flag is set to false when the object     * size is changed.     *     * @serial     * @see #isValid     * @see #validate     * @see #invalidate     */    boolean valid = false;    /**     * A components name.     * This field can be null.     *     * @serial     * @see getName()     * @see setName(String)     */    private String name;    /**     * A bool to determine whether the name has     * been set explicitly. nameExplicitlySet will     * be false if the name has not been set and     * true if it has.     *     * @serial     * @see getName()     * @see setName(String)     */    private boolean nameExplicitlySet = false;    /**     * The locking object for AWT component-tree and layout operations.     *     * @see #getTreeLock     */    static final Object LOCK = new AWTTreeLock();    static class AWTTreeLock {}    /**     * Internal, cached size information.     * (This field perhaps should have been transient).     *     * @serial     */    Dimension minSize;    /** Internal, cached size information     * (This field perhaps should have been transient).     *     * @serial     */    Dimension prefSize;    boolean newEventsOnly = false;    transient ComponentListener componentListener;    transient FocusListener focusListener;    transient KeyListener keyListener;    transient MouseListener mouseListener;    transient MouseMotionListener mouseMotionListener;    transient MouseWheelListener mouseWheelListener;    transient InputMethodListener inputMethodListener;    /**     * The eventMask is ONLY set by subclasses via enableEvents.     * The mask should NOT be set when listeners are registered     * so that we can distinguish the difference between when     * listeners request events and subclasses request them.     * One bit is used to indicate whether input methods are     * enabled; this bit is set by enableInputMethods and is     * on by default.     *     * @serial     * @see enableInputMethods()     */    long eventMask = AWTEvent.INPUT_METHODS_ENABLED_MASK;    /**     * Static properties for incremental drawing.     * @see #imageUpdate     */    static boolean isInc;    static int incRate;    static {        String s = (String) AccessController.doPrivileged(                new GetPropertyAction("awt.image.incrementaldraw"));        isInc = (s == null || s.equals("true"));        s = (String) AccessController.doPrivileged(                    new GetPropertyAction("awt.image.redrawrate"));        incRate = (s != null) ? Integer.parseInt(s) : 100;    }    /**     * Ease-of-use constant for <code>getAlignmentY()</code>.  Specifies an     * alignment to the top of the component.     * @see     #getAlignmentY     */    public static final float TOP_ALIGNMENT = 0.0f;    /**     * Ease-of-use constant for <code>getAlignmentY</code> and     * <code>getAlignmentX</code>. Specifies an alignment to     * the center of the component     * @see     #getAlignmentX     * @see     #getAlignmentY     */    public static final float CENTER_ALIGNMENT = 0.5f;    /**     * Ease-of-use constant for <code>getAlignmentY</code>.  Specifies an     * alignment to the bottom of the component.     * @see     #getAlignmentY     */    public static final float BOTTOM_ALIGNMENT = 1.0f;    /**     * Ease-of-use constant for <code>getAlignmentX</code>.  Specifies an     * alignment to the left side of the component.     * @see     #getAlignmentX     */    public static final float LEFT_ALIGNMENT = 0.0f;    /**     * Ease-of-use constant for <code>getAlignmentX</code>.  Specifies an     * alignment to the right side of the component.     * @see     #getAlignmentX     */    public static final float RIGHT_ALIGNMENT = 1.0f;    /*     * JDK 1.1 serialVersionUID     */    private static final long serialVersionUID = -7644114512714619750L;    /**     * If any PropertyChangeListeners have been registered, the     * changeSupport field describes them.     *     * @serial     * @since 1.2     * @see addPropertyChangeListener     * @see removePropertyChangeListener     * @see firePropertyChange     */    private java.beans.PropertyChangeSupport changeSupport;    /** Internal, constants for serialization */    final static String actionListenerK = "actionL";    final static String adjustmentListenerK = "adjustmentL";    final static String componentListenerK = "componentL";    final static String containerListenerK = "containerL";    final static String focusListenerK = "focusL";    final static String itemListenerK = "itemL";    final static String keyListenerK = "keyL";    final static String mouseListenerK = "mouseL";    final static String mouseMotionListenerK = "mouseMotionL";    final static String mouseWheelListenerK = "mouseWheelL";    final static String textListenerK = "textL";    final static String windowListenerK = "windowL";    final static String inputMethodListenerK = "inputMethodL";    boolean isPacked = false;    private static Timer TIMER;    /**     * The <code>AppContext</code> of the component.  This is set in     * the constructor and never changes.

⌨️ 快捷键说明

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