All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.awt.EventQueue Maven / Gradle / Ivy

/*

NOTICE


(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.

Neither this file nor any files generated from it describe a complete specification, and they may only be used as described below. For example, no permission is given for you to incorporate this file, in whole or in part, in an implementation of a Java specification.

Sun Microsystems Inc. owns the copyright in this file and it is provided to you for informative, as opposed to normative, use. The file and any files generated from it may be used to generate other informative documentation, such as a unified set of documents of API signatures for a platform that includes technologies expressed as Java APIs. The file may also be used to produce "compilation stubs," which allow applications to be compiled and validated for such platforms.

Any work generated from this file, such as unified javadocs or compiled stub files, must be accompanied by this notice in its entirety.

This work corresponds to the API signatures of JSR 217: Personal Basis Profile 1.1. In the event of a discrepency between this work and the JSR 217 specification, which is available at http://www.jcp.org/en/jsr/detail?id=217, the latter takes precedence. */ package java.awt; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; import java.awt.event.InputEvent; // import java.awt.event.InputMethodEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.PaintEvent; import java.awt.event.WindowEvent; import java.awt.ActiveEvent; // import java.awt.peer.ComponentPeer; // import java.awt.peer.LightweightPeer; import java.util.EmptyStackException; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationTargetException; import java.security.AccessController; import java.security.PrivilegedAction; // import sun.awt.PeerEvent; // import sun.awt.SunToolkit; // import sun.awt.DebugHelper; // import sun.awt.AWTAutoShutdown; // import sun.awt.AppContext; /** * EventQueue is a platform-independent class * that queues events, both from the underlying peer classes * and from trusted application classes. *

* It encapsulates asynchronous event dispatch machinery which * extracts events from the queue and dispatches them by calling * {@link #dispatchEvent(AWTEvent) dispatchEvent(AWTEvent)} method * on this EventQueue with the event to be dispatched * as an argument. The particular behavior of this machinery is * implementation-dependent. The only requirements are that events * which were actually enqueued to this queue (note that events * being posted to the EventQueue can be coalesced) * are dispatched: *

*
Sequentially. *
That is, it is not permitted that several events from * this queue are dispatched simultaneously. *
In the same order as they are enqueued. *
That is, if AWTEvent A is enqueued * to the EventQueue before * AWTEvent B then event B will not be * dispatched before event A. *
*

* Some browsers partition applets in different code bases into * separate contexts, and establish walls between these contexts. * In such a scenario, there will be one EventQueue * per context. Other browsers place all applets into the same * context, implying that there will be only a single, global * EventQueue for all applets. This behavior is * implementation-dependent. Consult your browser's documentation * for more information. *

* For information on the threading issues of the event dispatch * machinery, see AWT Threading * Issues. * * * @author Thomas Ball * @author Fred Ecks * @author David Mendenhall * * @version 1.88, 01/28/03 * @since 1.1 */ public class EventQueue { public EventQueue() { } /** * Posts a 1.1-style event to the EventQueue. * If there is an existing event on the queue with the same ID * and event source, the source Component's * coalesceEvents method will be called. * * @param theEvent an instance of java.awt.AWTEvent, * or a subclass of it * @throws NullPointerException if theEvent is null */ public void postEvent(AWTEvent theEvent) { } /** * Removes an event from the EventQueue and * returns it. This method will block until an event has * been posted by another thread. * @return the next AWTEvent * @exception InterruptedException * if another thread has interrupted this thread */ public AWTEvent getNextEvent() throws InterruptedException { return null; } /** * Returns the first event on the EventQueue * without removing it. * @return the first event */ public synchronized AWTEvent peekEvent() { return null; } /** * Returns the first event with the specified id, if any. * @param id the id of the type of event desired * @return the first event of the specified id or null * if there is no such event */ public synchronized AWTEvent peekEvent(int id) { return null; } /** * Dispatches an event. The manner in which the event is * dispatched depends upon the type of the event and the * type of the event's source object: *

* * * * * * * * * * * * * * * * * * * * * * * * * * *
Event TypeSource TypeDispatched To
ActiveEventAnyevent.dispatch()
OtherComponentsource.dispatchEvent(AWTEvent)
OtherMenuComponentsource.dispatchEvent(AWTEvent)
OtherOtherNo action (ignored)
*

* @param event an instance of java.awt.AWTEvent, * or a subclass of it * @throws NullPointerException if event is null */ protected void dispatchEvent(AWTEvent event) { } /** * Returns the timestamp of the most recent event that had a timestamp, and * that was dispatched from the EventQueue associated with the * calling thread. If an event with a timestamp is currently being * dispatched, its timestamp will be returned. If no events have yet * been dispatched, the EventQueue's initialization time will be * returned instead.In the current version of * the Java platform SDK, only InputEvents, * ActionEvents, and InvocationEvents have * timestamps; however, future versions of the SDK may add timestamps to * additional event types. Note that this method should only be invoked * from an application's event dispatching thread. If this method is * invoked from another thread, the current system time (as reported by * System.currentTimeMillis()) will be returned instead. * * @return the timestamp of the last InputEvent, * ActionEvent, or InvocationEvent to be * dispatched, or System.currentTimeMillis() if this * method is invoked on a thread other than an event dispatching * thread * @see java.awt.event.InputEvent#getWhen * @see java.awt.event.ActionEvent#getWhen * @see java.awt.event.InvocationEvent#getWhen * * @since 1.4 */ public static long getMostRecentEventTime() { return 0; } /** * Returns the the event currently being dispatched by the * EventQueue associated with the calling thread. This is * useful if a method needs access to the event, but was not designed to * receive a reference to it as an argument. Note that this method should * only be invoked from an application's event dispatching thread. If this * method is invoked from another thread, null will be returned. * * @return the event currently being dispatched, or null if this method is * invoked on a thread other than an event dispatching thread * @since 1.4 */ public static AWTEvent getCurrentEvent() { return null; } /** * Replaces the existing EventQueue with the specified one. * Any pending events are transferred to the new EventQueue * for processing by it. * * @param newEventQueue an EventQueue * (or subclass thereof) instance to be use * @see java.awt.EventQueue#pop * @throws NullPointerException if newEventQueue is null */ public synchronized void push(EventQueue newEventQueue) { } /** * Stops dispatching events using this EventQueue. * Any pending events are transferred to the previous * EventQueue for processing. *

* Warning: To avoid deadlock, do not declare this method * synchronized in a subclass. * * @exception EmptyStackException if no previous push was made * on this EventQueue * @see java.awt.EventQueue#push */ protected void pop() throws EmptyStackException { } /** * Returns true if the calling thread is the current AWT * EventQueue's dispatch thread. Use this * call the ensure that a given * task is being executed (or not being) on the current AWT * EventDispatchThread. * * @return true if running on the current AWT * EventQueue's dispatch thread */ public static boolean isDispatchThread() { return false; } /** * Causes runnable to have its run * method called in the dispatch thread of the EventQueue. * This will happen after all pending events are processed. * * @param runnable the Runnable whose run * method should be executed * synchronously on the EventQueue * @see #invokeAndWait * @since 1.2 */ public static void invokeLater(Runnable runnable) { } /** * Causes runnable to have its run * method called in the dispatch thread of the EventQueue. * This will happen after all pending events are processed. * The call blocks until this has happened. This method * will throw an Error if called from the event dispatcher thread. * * @param runnable the Runnable whose run * method should be executed * synchronously on the EventQueue * @exception InterruptedException if another thread has * interrupted this thread * @exception InvocationTargetException if an exception is thrown * when running runnable * @see #invokeLater * @since 1.2 */ public static void invokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException { } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy