类java.awt.peer.PopupMenuPeer源码实例Demo

下面列出了怎么用java.awt.peer.PopupMenuPeer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码3 项目: TencentKona-8   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码4 项目: jdk8u60   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码5 项目: JDKSourceCode1.8   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码7 项目: openjdk-jdk8u-backup   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码8 项目: Bytecoder   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码9 项目: openjdk-jdk9   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码10 项目: jdk8u-jdk   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码11 项目: Java8CN   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码12 项目: hottub   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码13 项目: openjdk-8-source   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码14 项目: openjdk-8   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码15 项目: jdk8u_jdk   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码16 项目: jdk8u-jdk   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码17 项目: jdk-1.7-annotated   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码18 项目: jdk8u-dev-jdk   文件: PopupMenu.java
/**
 * 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));
        }
    }
}
 
源代码19 项目: netbeans   文件: UtilitiesTest.java
protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
    throw new IllegalStateException("Method not implemented");
}
 
 类所在包
 类方法
 同包方法