Package java.awt.peer

Examples of java.awt.peer.MenuBarPeer


   *
   * @return the menu that was added
   */
  public synchronized Menu add(Menu menu)
  {
    MenuBarPeer myPeer = (MenuBarPeer) getPeer ();

    MenuContainer parent = menu.getParent();
    if (parent != null)
      parent.remove(menu);

    menus.addElement(menu);
    menu.setParent(this);

    if (myPeer != null)
      {
        menu.addNotify();
        myPeer.addMenu(menu);
      }
    return menu;
  }
View Full Code Here


   * @param index the index of the menu to remove from the menu bar
   */
  public synchronized void remove(int index)
  {
    Menu m = (Menu) menus.remove(index);
    MenuBarPeer mp = (MenuBarPeer) getPeer();

    if (mp != null)
      m.removeNotify();

    m.setParent(null);

    if (mp != null)
      mp.delMenu(index);
  }
View Full Code Here

  /**
   * Creates this object's native peer.
   */
  public void addNotify()
  {
    MenuBarPeer peer = (MenuBarPeer) getPeer();
    if (peer == null)
      {
  peer = getToolkit().createMenuBar(this);
  setPeer(peer);
      }

    Enumeration e = menus.elements();
    while (e.hasMoreElements())
      {
        Menu mi = (Menu)e.nextElement();
        mi.addNotify();
  peer.addMenu(mi);
      }

    if (helpMenu != null)
      {
        helpMenu.addNotify();
        peer.addHelpMenu(helpMenu);
      }
  }
View Full Code Here

            }
            helpMenu = m;
            if (m != null) {
                m.isHelpMenu = true;
                m.parent = this;
                MenuBarPeer peer = (MenuBarPeer)this.peer;
                if (peer != null) {
                    if (m.peer == null) {
                        m.addNotify();
                    }
                    peer.addHelpMenu(m);
                }
            }
        }
    }
View Full Code Here

                m.parent.remove(m);
            }
            menus.addElement(m);
            m.parent = this;

            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addMenu(m);
            }
            return m;
        }
    }
View Full Code Here

     */
    public void remove(int index) {
        synchronized (getTreeLock()) {
            Menu m = getMenu(index);
            menus.removeElementAt(index);
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                m.removeNotify();
                m.parent = null;
                peer.delMenu(index);
            }
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.peer.MenuBarPeer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.