jnodeevent.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 192 行

JAVA
192
字号
/*
 * $Id: JNodeEvent.java,v 1.3 2004/02/26 21:17:16 lsantha Exp $
 */
package org.jnode.wt.desktop;

/**
 * @author vali
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class JNodeEvent {

    /**
     * The ID of the event.
     *
     * @see #getID()
     * @see #JNodeEvent(Object, int)
     * @serial the identifier number of this event
     */
    private int id;

    /**
     * Indicates if the event has been consumed. False mean it is passed to
     * the peer, true means it has already been processed. Semantic events
     * generated by low-level events always have the value true.
     *
     * @see #consume()
     * @see #isConsumed()
     * @serial whether the event has been consumed
     */
    protected boolean consumed;


    /** Mask for selecting component focus events. */
    public static final long FOCUS_EVENT_MASK = 0x00004;

    /** Mask for selecting keyboard events. */
    public static final long KEY_EVENT_MASK = 0x00008;

    /** Mask for mouse button events. */
    public static final long MOUSE_EVENT_MASK = 0x00010;

    /** Mask for mouse motion events. */
    public static final long MOUSE_MOTION_EVENT_MASK = 0x00020;

    /** Mask for window events. */
    public static final long WINDOW_EVENT_MASK = 0x00040;

    /** Mask for action events. */
    public static final long ACTION_EVENT_MASK = 0x00080;

    /** Mask for adjustment events. */
    public static final long ADJUSTMENT_EVENT_MASK = 0x00100;

    /** Mask for item events. */
    public static final long ITEM_EVENT_MASK = 0x00200;

    /** Mask for text events. */
    public static final long TEXT_EVENT_MASK = 0x00400;

    /**
     * Mask for input method events.
     * @since 1.3
     */
    public static final long INPUT_METHOD_EVENT_MASK = 0x00800;

    /**
     * Mask if input methods are enabled. Package visible only.
     */
    static final long INPUT_ENABLED_EVENT_MASK = 0x01000;

    /**
     * Mask for paint events.
     * @since 1.3
     */
    public static final long PAINT_EVENT_MASK = 0x02000;

    /**
     * Mask for invocation events.
     * @since 1.3
     */
    public static final long INVOCATION_EVENT_MASK = 0x04000;

    /**
     * Mask for hierarchy events.
     * @since 1.3
     */
    public static final long HIERARCHY_EVENT_MASK = 0x08000;

    /**
     * Mask for hierarchy bounds events.
     * @since 1.3
     */
    public static final long HIERARCHY_BOUNDS_EVENT_MASK = 0x10000;

    /**
     * Mask for mouse wheel events.
     * @since 1.4
     */
    public static final long MOUSE_WHEEL_EVENT_MASK = 0x20000;


    private Object source = null;


    /**
     * Initializes a new AWTEvent from the old Java 1.0 event object.
     *
     * @param event the old-style event
     * @throws NullPointerException if event is null
     */

    /**
     * Create an event on the specified source object and id.
     *
     * @param source the object that caused the event
     * @param id the event id
     * @throws IllegalArgumentException if source is null
     */
    public JNodeEvent(Object source, int id) {
        if (source == null)
            throw new InstantiationError("The source object can not be null");
        this.source = source;
        this.id = id;
    }

    public void setSource(Object source) {
        this.source = source;
    }

    public Object getSource() {
        return this.source;
    }

    /**
     * Returns the event type id.
     *
     * @return the id number of this event
     */
    public int getID() {
        return id;
    }

    /**
     * Returns a string representation of this event. This is in the format
     * <code>getClass().getName() + '[' + paramString() + "] on "
     * + source</code>.
     *
     * @return a string representation of this event
     */
    public String toString() {
        return getClass().getName() + "[" + paramString() + "] on " + source;
    }

    /**
     * Returns a string representation of the state of this event. It may be
     * empty, but must not be null; it is implementation defined.
     *
     * @return a string representation of this event
     */
    public String paramString() {
        return "";
    }

    /**
     * Consumes this event so that it will not be processed in the default
     * manner.
     */
    /*
     * Changed from protected to public, as this method is needed in other
     * components like JNPanel, JNSimpleContainer.
     * if JN*** package hierarchy was Symmetrical to java.awt. this method can be kept
     * as protected, as the **Event and components are in different packages, this
     * need to be public to provide access.
     */
    public void consume() {
        consumed = true;
    }

    /**
     * Tests whether not not this event has been consumed. A consumed event
     * is not processed in the default manner.
     *
     * @return true if this event has been consumed
     */
    protected boolean isConsumed() {
        return consumed;
    }

}

⌨️ 快捷键说明

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