javax.swing.JFrame.setMenuBar()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(130)

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

JFrame.setMenuBar介绍

暂无

代码示例

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

class MyModule extends AbstractModule {
 @Override void configure() {
  requestInjection(this);
 }

 @Inject void addMenuToFrame(JFrame frame, JMenuBar menu) {
  frame.setMenuBar(menu);
 }
}

代码示例来源:origin: vgrazi/java-concurrent-animated

/**
 * If this is MS Windows, adds a menu bar
 * @param menuBar
 */
private void configureMSWindowsSpecificStuff(MenuBar menuBar) {
 if (File.pathSeparatorChar == ';') {
  // Windows
  frame.setMenuBar(menuBar);
 }
}

代码示例来源:origin: net.imagej/ij

public void windowActivated(WindowEvent e) {
  if (IJ.isMacOSX() && frame!=null)
    frame.setMenuBar(Menus.getMenuBar());
}

代码示例来源:origin: imagej/ImageJA

public void windowActivated(WindowEvent e) {
  if (IJ.isMacOSX() && frame!=null)
    frame.setMenuBar(Menus.getMenuBar());
}

代码示例来源:origin: gurkenlabs/litiengine

private static void setupInterface() {
 JFrame window = initWindow();
 Canvas canvas = Game.window().getRenderComponent();
 canvas.setFocusable(true);
 canvas.setSize((int) (window.getSize().width * 0.75), window.getSize().height);
 // remove canvas because we want to add a wrapping panel
 window.remove(canvas);
 initPopupMenus(canvas);
 JPanel renderPanel = new JPanel(new BorderLayout());
 renderPanel.add(canvas);
 renderPanel.setMinimumSize(new Dimension(300, 0));
 initScrollBars(renderPanel);
 JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, initRenderSplitPanel(renderPanel, window), initRightSplitPanel());
 split.setContinuousLayout(true);
 split.addComponentListener(new ComponentAdapter() {
  @Override
  public void componentResized(ComponentEvent e) {
   userPreferences.setWidth(window.getWidth());
   userPreferences.setHeight(window.getHeight());
  }
 });
 split.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, evt -> userPreferences.setMainSplitter(split.getDividerLocation()));
 JPanel rootPanel = new JPanel(new BorderLayout());
 window.setContentPane(rootPanel);
 rootPanel.add(split, BorderLayout.CENTER);
 split.setDividerLocation(userPreferences.getMainSplitterPosition() != 0 ? userPreferences.getMainSplitterPosition() : (int) (window.getSize().width * 0.75));
 JToolBar toolbar = initToolBar();
 rootPanel.add(toolbar, BorderLayout.NORTH);
 window.setMenuBar(initMenuBar());
}

代码示例来源:origin: jzyong/game-server

frame.add(view);
frame.setMenuBar(menuBar);

代码示例来源:origin: jzyong/game-server

frame.setMenuBar(menuBar);

代码示例来源:origin: jzyong/game-server

frame.setMenuBar(menuBar);

代码示例来源:origin: sc.fiji/TrakEM2_

if (IJ.isMacintosh() && IJ.getInstance()!=null) {
  IJ.wait(10); // may be needed for Java 1.4 on OS X
  this.frame.setMenuBar(ij.Menus.getMenuBar());

代码示例来源:origin: shizuchengxuyuan/net.sz.java

frame.add(view);
frame.setMenuBar(menuBar);

代码示例来源:origin: sc.fiji/TrakEM2_

/** Set the source Display as front. */
@Override
public void windowActivated(final WindowEvent we) {
  // find which was it to make it be the front
  final ImageJ ij = IJ.getInstance();
  if (null != ij && ij.quitting()) return;
  final Object source = we.getSource();
  for (final Display d : al_displays) {
    if (source == d.frame) {
      front = d;
      // set toolbar
      ProjectToolbar.setProjectToolbar();
      // now, select the layer in the LayerTree
      front.getProject().select(front.layer);
      // finally, set the virtual ImagePlus that ImageJ will see
      d.setTempCurrentImage();
      // copied from ij.gui.ImageWindow, with modifications
      if (IJ.isMacintosh() && IJ.getInstance()!=null) {
        IJ.wait(10); // may be needed for Java 1.4 on OS X
        d.frame.setMenuBar(Menus.getMenuBar());
      }
      return;
    }
  }
  // else, restore the ImageJ toolbar for non-project images
  //if (!source.equals(IJ.getInstance())) {
  //	ProjectToolbar.setImageJToolbar();
  //}
}
/** Restore the ImageJ toolbar */

相关文章

JFrame类方法