Java Code Examples for java.awt.peer.PopupMenuPeer

The following examples show how to use java.awt.peer.PopupMenuPeer. 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: jdk1.8-source-analysis   Source File: PopupMenu.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 2
Source Project: dragonwell8_jdk   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 3
Source Project: TencentKona-8   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 4
Source Project: jdk8u60   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 5
Source Project: JDKSourceCode1.8   Source File: PopupMenu.java    License: MIT License 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 6
Source Project: openjdk-jdk8u   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 7
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 8
Source Project: Bytecoder   Source File: PopupMenu.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this {@code PopupMenu} is being used as a {@code Menu}
 * (i.e., it has a non-{@code Component} parent),
 * then you cannot call this method on the {@code PopupMenu}.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is {@code null}
 * @exception IllegalArgumentException  if this {@code PopupMenu}
 *                has a non-{@code Component} parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
@SuppressWarnings("deprecation")
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.peer == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 9
Source Project: openjdk-jdk9   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this {@code PopupMenu} is being used as a {@code Menu}
 * (i.e., it has a non-{@code Component} parent),
 * then you cannot call this method on the {@code PopupMenu}.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is {@code null}
 * @exception IllegalArgumentException  if this {@code PopupMenu}
 *                has a non-{@code Component} parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
@SuppressWarnings("deprecation")
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.peer == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 10
Source Project: jdk8u-jdk   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 11
Source Project: Java8CN   Source File: PopupMenu.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 12
Source Project: hottub   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 13
Source Project: openjdk-8-source   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 14
Source Project: openjdk-8   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 15
Source Project: jdk8u_jdk   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 16
Source Project: jdk8u-jdk   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 17
Source Project: jdk-1.7-annotated   Source File: PopupMenu.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's heirarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 18
Source Project: jdk8u-dev-jdk   Source File: PopupMenu.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup menu at the x, y position relative to an origin
 * component.
 * The origin component must be contained within the component
 * hierarchy of the popup menu's parent.  Both the origin and the parent
 * must be showing on the screen for this method to be valid.
 * <p>
 * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
 * (i.e., it has a non-<code>Component</code> parent),
 * then you cannot call this method on the <code>PopupMenu</code>.
 *
 * @param origin the component which defines the coordinate space
 * @param x the x coordinate position to popup the menu
 * @param y the y coordinate position to popup the menu
 * @exception NullPointerException  if the parent is <code>null</code>
 * @exception IllegalArgumentException  if this <code>PopupMenu</code>
 *                has a non-<code>Component</code> parent
 * @exception IllegalArgumentException if the origin is not in the
 *                parent's hierarchy
 * @exception RuntimeException if the parent is not showing on screen
 */
public void show(Component origin, int x, int y) {
    // Use localParent for thread safety.
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException("parent is null");
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException(
            "PopupMenus with non-Component parents cannot be shown");
    }
    Component compParent = (Component)localParent;
    //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
    //Exception was not thrown if compParent was not equal to origin and
    //was not Container
    if (compParent != origin) {
        if (compParent instanceof Container) {
            if (!((Container)compParent).isAncestorOf(origin)) {
                throw new IllegalArgumentException("origin not in parent's hierarchy");
            }
        } else {
            throw new IllegalArgumentException("origin not in parent's hierarchy");
        }
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException("parent not showing on screen");
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer)peer).show(
                new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}
 
Example 19
Source Project: netbeans   Source File: UtilitiesTest.java    License: Apache License 2.0 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
    throw new IllegalStateException("Method not implemented");
}