Java Code Examples for java.awt.ActiveEvent

The following examples show how to use java.awt.ActiveEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: xdm   Source File: XDMFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
private synchronized void startModal(Component comp) {
	try {
		if (SwingUtilities.isEventDispatchThread()) {
			EventQueue theQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
			while (comp.isVisible()) {
				AWTEvent event = theQueue.getNextEvent();
				Object source = event.getSource();
				if (event instanceof ActiveEvent) {
					((ActiveEvent) event).dispatch();
				} else if (source instanceof Component) {
					((Component) source).dispatchEvent(event);
				} else if (source instanceof MenuComponent) {
					((MenuComponent) source).dispatchEvent(event);
				} else {
					System.err.println("Unable to dispatch: " + event);
				}
			}
		} else {
			while (comp.isVisible()) {
				wait();
			}
		}
	} catch (InterruptedException ignored) {
	}
}
 
Example 2
Source Project: JsDroidCmd   Source File: SwingGui.java    License: Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Processes the next GUI event.
 */
public void dispatchNextGuiEvent() throws InterruptedException {
    EventQueue queue = awtEventQueue;
    if (queue == null) {
        queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
        awtEventQueue = queue;
    }
    AWTEvent event = queue.getNextEvent();
    if (event instanceof ActiveEvent) {
        ((ActiveEvent)event).dispatch();
    } else {
        Object source = event.getSource();
        if (source instanceof Component) {
            Component comp = (Component)source;
            comp.dispatchEvent(event);
        } else if (source instanceof MenuComponent) {
            ((MenuComponent)source).dispatchEvent(event);
        }
    }
}
 
Example 3
Source Project: astor   Source File: SwingGui.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Processes the next GUI event.
 */
public void dispatchNextGuiEvent() throws InterruptedException {
    EventQueue queue = awtEventQueue;
    if (queue == null) {
        queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
        awtEventQueue = queue;
    }
    AWTEvent event = queue.getNextEvent();
    if (event instanceof ActiveEvent) {
        ((ActiveEvent)event).dispatch();
    } else {
        Object source = event.getSource();
        if (source instanceof Component) {
            Component comp = (Component)source;
            comp.dispatchEvent(event);
        } else if (source instanceof MenuComponent) {
            ((MenuComponent)source).dispatchEvent(event);
        }
    }
}