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

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

源代码1 项目: jdk1.8-source-analysis   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码2 项目: jdk1.8-source-analysis   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码3 项目: jdk1.8-source-analysis   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
            m.parent = null;
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码5 项目: dragonwell8_jdk   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码6 项目: dragonwell8_jdk   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
            m.parent = null;
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码7 项目: TencentKona-8   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码8 项目: TencentKona-8   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码9 项目: TencentKona-8   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
            m.parent = null;
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码10 项目: jdk8u60   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码11 项目: jdk8u60   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            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;
    }
}
 
源代码12 项目: jdk8u60   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final 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);
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码13 项目: JDKSourceCode1.8   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码14 项目: JDKSourceCode1.8   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码15 项目: JDKSourceCode1.8   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
            m.parent = null;
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码16 项目: openjdk-jdk8u   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码17 项目: openjdk-jdk8u   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码18 项目: openjdk-jdk8u   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
            m.parent = null;
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码20 项目: openjdk-jdk8u-backup   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
            m.parent = null;
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码22 项目: Bytecoder   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码23 项目: Bytecoder   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码24 项目: Bytecoder   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
        }
        m.parent = null;
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码25 项目: openjdk-jdk9   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码26 项目: openjdk-jdk9   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            m.parent.remove(m);
        }
        m.parent = this;

        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            if (m.peer == null) {
                m.addNotify();
            }
            menus.addElement(m);
            peer.addMenu(m);
        } else {
            menus.addElement(m);
        }
        return m;
    }
}
 
源代码27 项目: openjdk-jdk9   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final int index) {
    synchronized (getTreeLock()) {
        Menu m = getMenu(index);
        menus.removeElementAt(index);
        MenuBarPeer peer = (MenuBarPeer)this.peer;
        if (peer != null) {
            peer.delMenu(index);
            m.removeNotify();
        }
        m.parent = null;
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
源代码28 项目: jdk8u-jdk   文件: MenuBar.java
/**
 * Sets the specified menu to be this menu bar's help menu.
 * If this menu bar has an existing help menu, the old help menu is
 * removed from the menu bar, and replaced with the specified menu.
 * @param m    the menu to be set as the help menu
 */
public void setHelpMenu(final Menu m) {
    synchronized (getTreeLock()) {
        if (helpMenu == m) {
            return;
        }
        if (helpMenu != null) {
            remove(helpMenu);
        }
        helpMenu = m;
        if (m != null) {
            if (m.parent != this) {
                add(m);
            }
            m.isHelpMenu = true;
            m.parent = this;
            MenuBarPeer peer = (MenuBarPeer)this.peer;
            if (peer != null) {
                if (m.peer == null) {
                    m.addNotify();
                }
                peer.addHelpMenu(m);
            }
        }
    }
}
 
源代码29 项目: jdk8u-jdk   文件: MenuBar.java
/**
 * Adds the specified menu to the menu bar.
 * If the menu has been part of another menu bar,
 * removes it from that menu bar.
 *
 * @param        m   the menu to be added
 * @return       the menu added
 * @see          java.awt.MenuBar#remove(int)
 * @see          java.awt.MenuBar#remove(java.awt.MenuComponent)
 */
public Menu add(Menu m) {
    synchronized (getTreeLock()) {
        if (m.parent != null) {
            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;
    }
}
 
源代码30 项目: jdk8u-jdk   文件: MenuBar.java
/**
 * Removes the menu located at the specified
 * index from this menu bar.
 * @param        index   the position of the menu to be removed.
 * @see          java.awt.MenuBar#add(java.awt.Menu)
 */
public void remove(final 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);
        }
        if (helpMenu == m) {
            helpMenu = null;
            m.isHelpMenu = false;
        }
    }
}
 
 类所在包
 同包方法