java.awt.MenuComponent Java Examples

The following examples show how to use java.awt.MenuComponent. 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: WaitCursorEventQueue.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
public synchronized void run() {
	while (true) {
		try {
			wait();
			wait(delay);
			if (source instanceof Component) {
				parent = SwingUtilities.getRoot((Component) source);
			} else if (source instanceof MenuComponent) {
				MenuContainer mParent = ((MenuComponent) source).getParent();
				if (mParent instanceof Component) {
					parent = SwingUtilities.getRoot((Component) mParent);
				}
			}
			if ((parent != null) && parent.isShowing()) {
				parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			}
		} catch (InterruptedException ie) {
		}
	}
}
 
Example #2
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);
        }
    }
}
 
Example #3
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 #4
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 #5
Source File: ComponentOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps {@code Component.remove(MenuComponent)} through queue
 */
public void remove(final MenuComponent menuComponent) {
    runMapping(new MapVoidAction("remove") {
        @Override
        public void map() {
            getSource().remove(menuComponent);
        }
    });
}
 
Example #6
Source File: CMenuComponent.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(final MenuComponent target) {
    super(0, true);
    this.target = target;
    setPtr(createModel());
}
 
Example #7
Source File: CMenuComponent.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(final MenuComponent target) {
    super(0, true);
    this.target = target;
    setPtr(createModel());
}
 
Example #8
Source File: CMenuComponent.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
final MenuComponent getTarget() {
    return target;
}
 
Example #9
Source File: CMenuComponent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(MenuComponent target) {
    this.target = target;
    this.modelPtr = createModel();
}
 
Example #10
Source File: CMenuComponent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
MenuComponent getTarget() {
    return target;
}
 
Example #11
Source File: CMenuComponent.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(MenuComponent target) {
    this.target = target;
    this.modelPtr = createModel();
}
 
Example #12
Source File: CMenuComponent.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
MenuComponent getTarget() {
    return target;
}
 
Example #13
Source File: JTitledPanel.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
public void remove(MenuComponent component) {
    getContentPanel().remove(component);
}
 
Example #14
Source File: CMenuComponent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(MenuComponent target) {
    this.target = target;
    this.modelPtr = createModel();
}
 
Example #15
Source File: CMenuComponent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
MenuComponent getTarget() {
    return target;
}
 
Example #16
Source File: CMenuComponent.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(final MenuComponent target) {
    super(0, true);
    this.target = target;
    setPtr(createModel());
}
 
Example #17
Source File: CMenuComponent.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
final MenuComponent getTarget() {
    return target;
}
 
Example #18
Source File: CMenuComponent.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(MenuComponent target) {
    this.target = target;
    this.modelPtr = createModel();
}
 
Example #19
Source File: CMenuComponent.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
MenuComponent getTarget() {
    return target;
}
 
Example #20
Source File: CMenuComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(MenuComponent target) {
    this.target = target;
    this.modelPtr = createModel();
}
 
Example #21
Source File: CMenuComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
MenuComponent getTarget() {
    return target;
}
 
Example #22
Source File: Swing.java    From pdfxtk with Apache License 2.0 4 votes vote down vote up
public static void startModal(javax.swing.JInternalFrame f) {
   synchronized(f) {
     /* Since all input will be blocked until this dialog is dismissed,
      * make sure its parent containers are visible first (this component
      * is tested below).  This is necessary for JApplets, because
      * because an applet normally isn't made visible until after its
      * start() method returns -- if this method is called from start(),
      * the applet will appear to hang while an invisible modal frame
      * waits for input.
      */
     
     if (f.isVisible() && !f.isShowing()) {
Container parent = f.getParent();
while (parent != null) {
  if (parent.isVisible() == false) {
    parent.setVisible(true);
  }
  parent = parent.getParent();
}
     }

     try {
if (SwingUtilities.isEventDispatchThread()) {
  EventQueue theQueue = f.getToolkit().getSystemEventQueue();
  while (f.isVisible()) {
    // This is essentially the body of EventDispatchThread
    AWTEvent event = theQueue.getNextEvent();
    Object src = event.getSource();
    // can't call theQueue.dispatchEvent, so I pasted it's body here
    /*if (event instanceof ActiveEvent) {
      ((ActiveEvent) event).dispatch();
      } else */ if (src instanceof Component) {
	((Component) src).dispatchEvent(event);
      } else if (src instanceof MenuComponent) {
	((MenuComponent) src).dispatchEvent(event);
      } else {
	System.err.println("unable to dispatch event: " + event);
      }
  }
} else
  while (f.isVisible())
    f.wait();
     } catch(InterruptedException e){}
   }
 }
 
Example #23
Source File: CMenuComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(final MenuComponent target) {
    super(0, true);
    this.target = target;
    setPtr(createModel());
}
 
Example #24
Source File: CMenuComponent.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
final MenuComponent getTarget() {
    return target;
}
 
Example #25
Source File: CMenuComponent.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(final MenuComponent target) {
    super(0, true);
    this.target = target;
    setPtr(createModel());
}
 
Example #26
Source File: CMenuComponent.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
final MenuComponent getTarget() {
    return target;
}
 
Example #27
Source File: CMenuComponent.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(MenuComponent target) {
    this.target = target;
    this.modelPtr = createModel();
}
 
Example #28
Source File: CMenuComponent.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
MenuComponent getTarget() {
    return target;
}
 
Example #29
Source File: CMenuComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
CMenuComponent(final MenuComponent target) {
    super(0, true);
    this.target = target;
    setPtr(createModel());
}
 
Example #30
Source File: CMenuComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
final MenuComponent getTarget() {
    return target;
}