java.awt.ActiveEvent Java Examples

The following examples show how to use java.awt.ActiveEvent. 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 check out the related API usage on the sidebar.
Example #1
Source File: XDMFrame.java    From xdm with 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 File: SwingGui.java    From JsDroidCmd with 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 File: SwingGui.java    From astor with 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);
        }
    }
}