本文整理汇总了Java中java.awt.peer.FramePeer.setMenuBar方法的典型用法代码示例。如果您正苦于以下问题:Java FramePeer.setMenuBar方法的具体用法?Java FramePeer.setMenuBar怎么用?Java FramePeer.setMenuBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.FramePeer
的用法示例。
在下文中一共展示了FramePeer.setMenuBar方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNotify
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Makes this Frame displayable by connecting it to
* a native screen resource. Making a frame displayable will
* cause any of its children to be made displayable.
* This method is called internally by the toolkit and should
* not be called directly by programs.
* @see Component#isDisplayable
* @see #removeNotify
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null) {
peer = getToolkit().createFrame(this);
}
FramePeer p = (FramePeer)peer;
MenuBar menuBar = this.menuBar;
if (menuBar != null) {
mbManagement = true;
menuBar.addNotify();
p.setMenuBar(menuBar);
}
p.setMaximizedBounds(maximizedBounds);
super.addNotify();
}
}
示例2: setMenuBar
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Sets the menu bar for this frame to the specified menu bar.
* @param mb the menu bar being set.
* If this parameter is <code>null</code> then any
* existing menu bar on this frame is removed.
* @see #getMenuBar
*/
public void setMenuBar(MenuBar mb) {
synchronized (getTreeLock()) {
if (menuBar == mb) {
return;
}
if ((mb != null) && (mb.parent != null)) {
mb.parent.remove(mb);
}
if (menuBar != null) {
remove(menuBar);
}
menuBar = mb;
if (menuBar != null) {
menuBar.parent = this;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
menuBar.addNotify();
invalidateIfValid();
peer.setMenuBar(menuBar);
}
}
}
}
示例3: remove
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Removes the specified menu bar from this frame.
* @param m the menu component to remove.
* If <code>m</code> is <code>null</code>, then
* no action is taken
*/
public void remove(MenuComponent m) {
if (m == null) {
return;
}
synchronized (getTreeLock()) {
if (m == menuBar) {
menuBar = null;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
invalidateIfValid();
peer.setMenuBar(null);
m.removeNotify();
}
m.parent = null;
} else {
super.remove(m);
}
}
}
示例4: removeNotify
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Makes this Frame undisplayable by removing its connection
* to its native screen resource. Making a Frame undisplayable
* will cause any of its children to be made undisplayable.
* This method is called by the toolkit internally and should
* not be called directly by programs.
* @see Component#isDisplayable
* @see #addNotify
*/
public void removeNotify() {
synchronized (getTreeLock()) {
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
// get the latest Frame state before disposing
getState();
if (menuBar != null) {
mbManagement = true;
peer.setMenuBar(null);
menuBar.removeNotify();
}
}
super.removeNotify();
}
}
示例5: addNotify
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Makes this Frame displayable by connecting it to
* a native screen resource. Making a frame displayable will
* cause any of its children to be made displayable.
* This method is called internally by the toolkit and should
* not be called directly by programs.
* @see Component#isDisplayable
* @see #removeNotify
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null) {
peer = getComponentFactory().createFrame(this);
}
FramePeer p = (FramePeer)peer;
MenuBar menuBar = this.menuBar;
if (menuBar != null) {
mbManagement = true;
menuBar.addNotify();
p.setMenuBar(menuBar);
}
p.setMaximizedBounds(maximizedBounds);
super.addNotify();
}
}
示例6: setMenuBar
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Sets the menu bar for this frame to the specified menu bar.
* @param mb the menu bar being set.
* If this parameter is {@code null} then any
* existing menu bar on this frame is removed.
* @see #getMenuBar
*/
public void setMenuBar(MenuBar mb) {
synchronized (getTreeLock()) {
if (menuBar == mb) {
return;
}
if ((mb != null) && (mb.parent != null)) {
mb.parent.remove(mb);
}
if (menuBar != null) {
remove(menuBar);
}
menuBar = mb;
if (menuBar != null) {
menuBar.parent = this;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
menuBar.addNotify();
invalidateIfValid();
peer.setMenuBar(menuBar);
}
}
}
}
示例7: remove
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Removes the specified menu bar from this frame.
* @param m the menu component to remove.
* If {@code m} is {@code null}, then
* no action is taken
*/
public void remove(MenuComponent m) {
if (m == null) {
return;
}
synchronized (getTreeLock()) {
if (m == menuBar) {
menuBar = null;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
invalidateIfValid();
peer.setMenuBar(null);
m.removeNotify();
}
m.parent = null;
} else {
super.remove(m);
}
}
}
示例8: setMenuBar
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Sets this frame's menu bar. Removes any existing menu bar. If the
* given menu bar is part of another frame it will be removed from
* that frame.
*
* @param menuBar the new menu bar for this frame
*/
public synchronized void setMenuBar(MenuBar menuBar)
{
if (this.menuBar != null)
remove(this.menuBar);
this.menuBar = menuBar;
if (menuBar != null)
{
MenuContainer parent = menuBar.getParent();
if (parent != null)
parent.remove(menuBar);
menuBar.setParent(this);
// Create local copy for thread safety.
FramePeer p = (FramePeer) peer;
if (p != null)
{
if (menuBar != null)
menuBar.addNotify();
if (valid)
invalidate();
p.setMenuBar(menuBar);
}
}
}
示例9: setMenuBar
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Sets this frame's menu bar. Removes any existing menu bar. If the
* given menu bar is part of another frame it will be removed from
* that frame.
*
* @param menuBar the new menu bar for this frame
*/
public synchronized void setMenuBar(MenuBar menuBar)
{
if (this.menuBar != null)
remove(this.menuBar);
this.menuBar = menuBar;
if (menuBar != null)
{
MenuContainer parent = menuBar.getParent();
if (parent != null)
parent.remove(menuBar);
menuBar.setParent(this);
// Create local copy for thread safety.
FramePeer p = (FramePeer) peer;
if (p != null)
{
if (menuBar != null)
menuBar.addNotify();
if (valid)
invalidate();
p.setMenuBar(menuBar);
}
}
}
示例10: addNotify
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Makes this Frame displayable by connecting it to
* a native screen resource. Making a frame displayable will
* cause any of its children to be made displayable.
* This method is called internally by the toolkit and should
* not be called directly by programs.
* @see Component#isDisplayable
* @see #removeNotify
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null) {
peer = getToolkit().createFrame(this);
}
FramePeer p = (FramePeer)peer;
MenuBar menuBar = this.menuBar;
if (menuBar != null) {
mbManagement = true;
menuBar.addNotify();
p.setMenuBar(menuBar);
}
p.setMaximizedBounds(maximizedBounds);
super.addNotify();
}
}
示例11: remove
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Removes the specified menu bar from this frame.
* @param m the menu component to remove.
* If <code>m</code> is <code>null</code>, then
* no action is taken
*/
public void remove(MenuComponent m) {
if (m == null) {
return;
}
synchronized (getTreeLock()) {
if (m == menuBar) {
menuBar = null;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
if (valid) {
invalidate();
}
peer.setMenuBar(null);
m.removeNotify();
}
m.parent = null;
} else {
super.remove(m);
}
}
}
示例12: removeNotify
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Makes this Frame undisplayable by removing its connection
* to its native screen resource. Making a Frame undisplayable
* will cause any of its children to be made undisplayable.
* This method is called by the toolkit internally and should
* not be called directly by programs.
* @see Component#isDisplayable
* @see #addNotify
*/
public void removeNotify() {
synchronized (getTreeLock()) {
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
// get the latest Frame state before disposing
getState();
if (menuBar != null) {
mbManagement = true;
peer.setMenuBar(null);
menuBar.removeNotify();
}
}
super.removeNotify();
}
}
示例13: setMenuBar
import java.awt.peer.FramePeer; //导入方法依赖的package包/类
/**
* Sets the menu bar for this frame to the specified menu bar.
* @param mb the menu bar being set.
* If this parameter is <code>null</code> then any
* existing menu bar on this frame is removed.
* @see #getMenuBar
*/
public void setMenuBar(MenuBar mb) {
synchronized (getTreeLock()) {
if (menuBar == mb) {
return;
}
if ((mb != null) && (mb.parent != null)) {
mb.parent.remove(mb);
}
if (menuBar != null) {
remove(menuBar);
}
menuBar = mb;
if (menuBar != null) {
menuBar.parent = this;
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
mbManagement = true;
menuBar.addNotify();
if (valid) {
invalidate();
}
peer.setMenuBar(menuBar);
}
}
}
}