org.eclipse.swt.widgets.Shell.setMenuBar()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.eclipse.swt.widgets.Shell.setMenuBar()方法的一些代码示例,展示了Shell.setMenuBar()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.setMenuBar()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:setMenuBar

Shell.setMenuBar介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

@Override
public void setShowMenuBar(boolean show) {
  showMenuBar = show;
  WorkbenchWindow win = (WorkbenchWindow) getWindow();
  Shell shell = win.getShell();
  if (shell != null) {
    boolean showing = shell.getMenuBar() != null;
    if (show != showing) {
      if (show) {
        shell.setMenuBar(null);
      } else {
        shell.setMenuBar(null);
      }
    }
  }
}

代码示例来源:origin: org.codehaus.openxma/xmartserver

/**
 * Creates the Menu which serves as the root menu widget and is set at: menuW.
 * In the MenuAppShell's implementation a Menu of the style SWT.BAR at the Shell's top is created.
 * This method can be overritten if some other kind of menu should be used as root
 * for the MenuItems (like a pop-up menu).
 * Altough this method can be overritten it is only to call by the XMA framework.
 * @return the Menu used as root for the MenuItems.
 */
protected Menu getMenu(){
  Shell shell = appShell.getShell();
  Menu aMenu = new Menu(shell,SWT.BAR);
  shell.setMenuBar(aMenu);
  return aMenu;
}

代码示例来源:origin: org.codehaus.openxma/xmartclient

/**
 * Creates the Menu which serves as the root menu widget and is set at: menuW.
 * In the MenuAppShell's implementation a Menu of the style SWT.BAR at the Shell's top is created.
 * This method can be overritten if some other kind of menu should be used as root
 * for the MenuItems (like a pop-up menu).
 * Altough this method can be overritten it is only to call by the XMA framework.
 * @return the Menu used as root for the MenuItems.
 */
protected Menu getMenu(){
  Shell shell = appShell.getShell();
  Menu aMenu = new Menu(shell,SWT.BAR);
  shell.setMenuBar(aMenu);
  return aMenu;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

Menu createMenuBar() {
  // Menu bar.
  Menu menuBar = new Menu(shell, SWT.BAR);
  shell.setMenuBar(menuBar);
  createFileMenu(menuBar);
  createAlphaMenu(menuBar);
  return menuBar;
}

代码示例来源:origin: be.yildiz-games/module-window-swt

public SwtMenuBar(Shell shell, MenuBarElement... barElements) {
  super();
  this.menu = new Menu(shell, SWT.BAR);
  shell.setMenuBar(menu);
  for(MenuBarElement e : barElements) {
    this.addToMenu(menu, e);
  }
  this.menu.setVisible(true);
}

代码示例来源:origin: stackoverflow.com

shell.setMenuBar(bar);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

void createMenuBar () {
  Menu bar = new Menu (shell, SWT.BAR);
  shell.setMenuBar (bar);

  MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
  fileItem.setText (resources.getString("File_menuitem"));
  fileItem.setMenu (createFileMenu ());

}

代码示例来源:origin: stackoverflow.com

if (menuBar == null) {
  menuBar = new Menu(shell, SWT.BAR);
  shell.setMenuBar(menuBar);

代码示例来源:origin: caoxinyu/RedisClient

private void initMenu() {
  menu = new Menu(shell, SWT.BAR);
  shell.setMenuBar(menu);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

shell.setImage(iconCache.stockImages[iconCache.shellIcon]);
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
createFileMenu(bar);
createHelpMenu(bar);

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Creates the trim widgets around the content area.
 * 
 * @param shell the shell
 * @since 1.0
 */
protected void createTrimWidgets(Shell shell) {
  if (menuBarManager != null) {
    shell.setMenuBar(menuBarManager.createMenuBar((Decorations) shell));
    menuBarManager.updateAll(true);
  }
  if (showTopSeperator()) {
    seperator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
  }
  // will create either a cool bar or a tool bar
  createToolBarControl(shell);
  createCoolBarControl(shell);
  createStatusLine(shell);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

/**
 * Creates the menu at the top of the shell where most
 * of the programs functionality is accessed.
 *
 * @return        The <code>Menu</code> widget that was created
 */
private Menu createMenuBar() {
  Menu menuBar = new Menu(shell, SWT.BAR);
  shell.setMenuBar(menuBar);

  //create each header and subMenu for the menuBar
  createFileMenu(menuBar);
  createEditMenu(menuBar);
  createSearchMenu(menuBar);
  createHelpMenu(menuBar);

  return menuBar;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Creates the trim widgets around the content area.
 *
 * @param shell the shell
 * @since 3.0
 */
protected void createTrimWidgets(Shell shell) {
  if (menuBarManager != null) {
    boolean resizeHasOccurredBackup = this.resizeHasOccurred;
    shell.setMenuBar(menuBarManager.createMenuBar((Decorations) shell));
    this.resizeHasOccurred = resizeHasOccurredBackup;
    menuBarManager.updateAll(true);
  }
  if (showTopSeperator()) {
    seperator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
  }
  // will create either a cool bar or a tool bar
  createToolBarControl(shell);
  createCoolBarControl(shell);
  createStatusLine(shell);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Creates the trim widgets around the content area.
 *
 * @param shell the shell
 * @since 3.0
 */
protected void createTrimWidgets(Shell shell) {
  if (menuBarManager != null) {
    boolean resizeHasOccurredBackup = this.resizeHasOccurred;
    shell.setMenuBar(menuBarManager.createMenuBar((Decorations) shell));
    this.resizeHasOccurred = resizeHasOccurredBackup;
    menuBarManager.updateAll(true);
  }
  if (showTopSeperator()) {
    seperator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
  }
  // will create either a cool bar or a tool bar
  createToolBarControl(shell);
  createCoolBarControl(shell);
  createStatusLine(shell);
}

代码示例来源:origin: stackoverflow.com

shell.setMenuBar(menu);

代码示例来源:origin: org.microemu/microemu-javase-swt

shell.setMenuBar(bar);

代码示例来源:origin: org.xworker/xworker_swt

public static Menu createQuickMenu(ActionContext actionContext){
  Thing self = (Thing) actionContext.get("self");
  
  Menu menu = null;
  Object parent = actionContext.get("parent");
  if(parent instanceof Shell){
    Shell shell = (Shell) parent;
    menu = new Menu(shell, SWT.BAR);
    menu.setData(Designer.DATA_THING, self.getMetadata().getPath());
    shell.setMenuBar(menu);
    
    actionContext.peek().put("menu", menu);
  }else{
    menu = new Menu((Control) parent);		
    menu.setData(Designer.DATA_THING, self.getMetadata().getPath());
    ((Control) parent).setMenu(menu);
    actionContext.peek().put("menu", menu);			
  }
  
  for(Thing child : self.getChilds("Menu")){
    child.doAction("create", actionContext);
  }
  
  return menu;
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

renderer.createGui(wbwModel.getMainMenu(), me.getWidget(), null);
Shell shell = (Shell) me.getWidget();
shell.setMenuBar((Menu) wbwModel.getMainMenu().getWidget());

代码示例来源:origin: stefanhaustein/flowgrid

shell.setMenuBar(menuBar);

代码示例来源:origin: tvrenamer/tvrenamer

shell.setMenuBar(menuBarMenu);

相关文章

微信公众号

最新文章

更多

Shell类方法