Java Code Examples for java.awt.peer.PopupMenuPeer

The following are top voted examples for showing how to use java.awt.peer.PopupMenuPeer. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: javify   File: PopupMenu.java   View source code 6 votes vote down vote up
/**
  * Displays this popup menu at the specified coordinates relative to
  * the specified component.
  *
  * @param component The component to which the display coordinates are relative.
  * @param x The X coordinate of the menu.
  * @param y The Y coordinate of the menu.
  */
public void
show(Component component, int x, int y)
{
  if (getPeer() == null)
    this.addNotify();
  PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
  if (pmp != null)
    {
      /* XXX
      Event e = new Event (component, Event.ACTION_EVENT, component);
      e.x = x;
      e.y = y;*/
      pmp.show (component, x, y);
    }
}
 
Example 2
Project: jvm-stm   File: PopupMenu.java   View source code 6 votes vote down vote up
/**
  * Displays this popup menu at the specified coordinates relative to
  * the specified component.
  *
  * @param component The component to which the display coordinates are relative.
  * @param x The X coordinate of the menu.
  * @param y The Y coordinate of the menu.
  */
public void
show(Component component, int x, int y)
{
  if (getPeer() == null)
    this.addNotify();
  PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
  if (pmp != null)
    {
      /* XXX
      Event e = new Event (component, Event.ACTION_EVENT, component);
      e.x = x;
      e.y = y;*/
      pmp.show (component, x, y);
    }
}
 
Example 3
Project: JamVM-PH   File: PopupMenu.java   View source code 6 votes vote down vote up
/**
  * Displays this popup menu at the specified coordinates relative to
  * the specified component.
  *
  * @param component The component to which the display coordinates are relative.
  * @param x The X coordinate of the menu.
  * @param y The Y coordinate of the menu.
  */
public void
show(Component component, int x, int y)
{
  if (getPeer() == null)
    this.addNotify();
  PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
  if (pmp != null)
    {
      /* XXX
      Event e = new Event (component, Event.ACTION_EVENT, component);
      e.x = x;
      e.y = y;*/
      pmp.show (component, x, y);
    }
}
 
Example 4
Project: classpath   File: PopupMenu.java   View source code 6 votes vote down vote up
/**
  * Displays this popup menu at the specified coordinates relative to
  * the specified component.
  *
  * @param component The component to which the display coordinates are relative.
  * @param x The X coordinate of the menu.
  * @param y The Y coordinate of the menu.
  */
public void
show(Component component, int x, int y)
{
  if (getPeer() == null)
    this.addNotify();
  PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
  if (pmp != null)
    {
      /* XXX
      Event e = new Event (component, Event.ACTION_EVENT, component);
      e.x = x;
      e.y = y;*/
      pmp.show (component, x, y);
    }
}
 
Example 5
Project: OpenJSharp   File: PopupMenu.java   View source code 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
Project: jdk8u-jdk   File: PopupMenu.java   View source code 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
Project: openjdk-jdk10   File: PopupMenu.java   View source code 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 8
Project: openjdk9   File: PopupMenu.java   View source code 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
 */
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
Project: Java8CN   File: PopupMenu.java   View source code 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 10
Project: jdk8u_jdk   File: PopupMenu.java   View source code 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
Project: lookaside_java-1.8.0-openjdk   File: PopupMenu.java   View source code 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
Project: VarJ   File: PopupMenu.java   View source code 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 13
Project: jdk-1.7-annotated   File: PopupMenu.java   View source code 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 14
Project: infobip-open-jdk-8   File: PopupMenu.java   View source code 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
Project: jdk8u-dev-jdk   File: PopupMenu.java   View source code 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
Project: jdk7-jdk   File: PopupMenu.java   View source code 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 17
Project: openjdk-source-code-learn   File: PopupMenu.java   View source code 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
Project: OLD-OpenJDK8   File: PopupMenu.java   View source code 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
Project: openjdk-jdk7u-jdk   File: PopupMenu.java   View source code 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 20
Project: openjdk-icedtea7   File: PopupMenu.java   View source code 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 21
Project: incubator-netbeans   File: UtilitiesTest.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
    throw new IllegalStateException("Method not implemented");
}
 
Example 22
Project: javify   File: XToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  // TODO: Implement this.
  throw new UnsupportedOperationException("Not yet implemented.");
}
 
Example 23
Project: javify   File: GtkToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu (PopupMenu target)
{
  checkHeadless();
  return new GtkPopupMenuPeer (target);
}
 
Example 24
Project: javify   File: QtToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  return new QtPopupMenuPeer( this, target );
}
 
Example 25
Project: javify   File: HeadlessToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  throw new HeadlessException();
}
 
Example 26
Project: jvm-stm   File: XToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  // TODO: Implement this.
  throw new UnsupportedOperationException("Not yet implemented.");
}
 
Example 27
Project: jvm-stm   File: GtkToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu (PopupMenu target) 
{
  checkHeadless();
  return new GtkPopupMenuPeer (target);
}
 
Example 28
Project: jvm-stm   File: QtToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  return new QtPopupMenuPeer( this, target );
}
 
Example 29
Project: jvm-stm   File: HeadlessToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  throw new HeadlessException();
}
 
Example 30
Project: cn1   File: HeadlessToolkit.java   View source code 4 votes vote down vote up
@Override
protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws HeadlessException {
    throw new HeadlessException();
}
 
Example 31
Project: JamVM-PH   File: XToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  // TODO: Implement this.
  throw new UnsupportedOperationException("Not yet implemented.");
}
 
Example 32
Project: JamVM-PH   File: GtkToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu (PopupMenu target) 
{
  checkHeadless();
  return new GtkPopupMenuPeer (target);
}
 
Example 33
Project: JamVM-PH   File: QtToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  return new QtPopupMenuPeer( this, target );
}
 
Example 34
Project: JamVM-PH   File: HeadlessToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  throw new HeadlessException();
}
 
Example 35
Project: GhostAWT   File: GhostToolkit.java   View source code 4 votes vote down vote up
@Override
protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
    return new GPopupMenuPeer(target);
}
 
Example 36
Project: awtonandroid   File: AndroidToolkit.java   View source code 4 votes vote down vote up
@Override
protected PopupMenuPeer createPopupMenu(PopupMenu arg0) {
	throw new UnsupportedOperationException("Not yet implemented.");
	//return null;
}
 
Example 37
Project: classpath   File: XToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  // TODO: Implement this.
  throw new UnsupportedOperationException("Not yet implemented.");
}
 
Example 38
Project: classpath   File: GtkToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu (PopupMenu target)
{
  checkHeadless();
  return new GtkPopupMenuPeer (target);
}
 
Example 39
Project: classpath   File: QtToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  return new QtPopupMenuPeer( this, target );
}
 
Example 40
Project: classpath   File: HeadlessToolkit.java   View source code 4 votes vote down vote up
protected PopupMenuPeer createPopupMenu(PopupMenu target)
{
  throw new HeadlessException();
}