Java Code Examples for javax.swing.JMenuBar

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.

Source file: AddisWindow.java

  22 
vote

private void initMenu(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(createFileMenu());
  menuBar.add(createEditMenu());
  menuBar.add(createAddMenu());
  menuBar.add(Box.createHorizontalGlue());
  menuBar.add(createHelpMenu());
  setJMenuBar(menuBar);
}
 

Example 2

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/.

Source file: NewExecutionListLauncherWindow.java

  22 
vote

private void enableImportWizard(boolean enable){
  JFrame mainFrame=ctxt.getMainFrame();
  if (mainFrame != null) {
    JMenuBar menuBar=mainFrame.getJMenuBar();
    activateMenu(menuBar,enable,"assistant","import");
  }
}
 

Example 3

From project collaborative-editor, under directory /mpedit/gui/.

Source file: CMenu.java

  22 
vote

/** 
 * our constructor
 * @param mainframe a reference to the mainframe
 */
public CMenu(CMainFrame mainframe){
  m_mainframe=mainframe;
  m_text=mainframe.getM_text();
  JMenuBar tmpMenuBar;
  try {
    tmpMenuBar=initMenu();
    this.add(tmpMenuBar);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 4

From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogBrokerMonitor.java

  22 
vote

protected JMenuBar createMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(createFileMenu());
  menuBar.add(createEditMenu());
  menuBar.add(createLogLevelMenu());
  menuBar.add(createViewMenu());
  menuBar.add(createConfigureMenu());
  menuBar.add(createHelpMenu());
  return (menuBar);
}
 

Example 5

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swing/src/com/toedter/e4/ui/workbench/renderers/swing/.

Source file: MenuBarRenderer.java

  22 
vote

@Override public void createWidget(MUIElement element,MElementContainer<MUIElement> parent){
  if (!(element instanceof MMenu)) {
    return;
  }
  if (parent != null && parent.getWidget() instanceof JMenuBar) {
    String label=((MUILabel)element).getLocalizedLabel();
    label=label.replaceAll("&","");
    JMenu menu=new JMenu(label);
    element.setWidget(menu);
    return;
  }
  JMenuBar menuBar=new JMenuBar();
  element.setWidget(menuBar);
}
 

Example 6

From project gitblit, under directory /src/com/gitblit/client/.

Source file: GitblitManager.java

  22 
vote

private JPanel getCenterPanel(){
  serverTabs=new JTabbedPane(JTabbedPane.TOP);
  JMenuBar menubar=setupMenu();
  JPanel panel=new JPanel(new BorderLayout());
  panel.add(menubar,BorderLayout.NORTH);
  panel.add(serverTabs,BorderLayout.CENTER);
  return panel;
}
 

Example 7

From project jreepad, under directory /src/jreepad/.

Source file: JreepadViewer.java

  22 
vote

private void establishMenus(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(createFileMenu());
  menuBar.add(createEditMenu());
  menuBar.add(createActionsMenu());
  menuBar.add(createViewMenu());
  menuBar.add(createOptionsMenu());
  menuBar.add(createHelpMenu());
  setJMenuBar(menuBar);
}
 

Example 8

From project jsmaa, under directory /main/src/main/java/fi/smaa/jsmaa/gui/.

Source file: AbstractGUIFactory.java

  22 
vote

private JMenuBar buildMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.putClientProperty(Options.HEADER_STYLE_KEY,HeaderStyle.BOTH);
  for (  JMenuItem l : getEntityMenuList()) {
    menuBar.add(l);
  }
  menuBar.add(buildResultsMenu());
  menuBar.add(Box.createHorizontalGlue());
  menuBar.add(buildHelpMenu());
  return menuBar;
}
 

Example 9

From project kabeja, under directory /blocks/svg/src/main/java/org/kabeja/processing/scripting/impl/.

Source file: JavaScriptShell.java

  22 
vote

protected JMenuBar createMenuBar(){
  JMenuBar menubar=new JMenuBar();
  JMenu menu=new JMenu("File");
  JMenuItem item=new JMenuItem((Action)actions.get("open"));
  item.setToolTipText(item.getText());
  menu.add(item);
  item=new JMenuItem((Action)actions.get("save"));
  menu.add(item);
  menu.add(new JSeparator());
  item=new JMenuItem((Action)actions.get("close"));
  menu.add(item);
  menubar.add(menu);
  return menubar;
}
 

Example 10

From project log4jna, under directory /thirdparty/log4j/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogBrokerMonitor.java

  22 
vote

protected JMenuBar createMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(createFileMenu());
  menuBar.add(createEditMenu());
  menuBar.add(createLogLevelMenu());
  menuBar.add(createViewMenu());
  menuBar.add(createConfigureMenu());
  menuBar.add(createHelpMenu());
  return (menuBar);
}
 

Example 11

From project mdk, under directory /ui/src/main/java/net/sf/furbelow/.

Source file: SpinningDialWaitIndicator.java

  22 
vote

public SpinningDialWaitIndicator(JFrame frame){
  this(frame.getLayeredPane());
  JMenuBar mb=frame.getJMenuBar();
  if (mb != null) {
    verticalOffset=mb.getHeight();
  }
}
 

Example 12

From project movsim, under directory /viewer/src/main/java/org/movsim/viewer/ui/.

Source file: AppletMenu.java

  22 
vote

public void initMenus(Applet frame){
  final JMenuBar menuBar=new JMenuBar();
  menuBar.add(scenarioMenu());
  menuBar.add(viewMenu());
  menuBar.add(helpMenu());
  frame.setJMenuBar(menuBar);
}
 

Example 13

From project nenya, under directory /tools/src/test/java/com/threerings/miso/viewer/.

Source file: ViewerFrame.java

  22 
vote

/** 
 * Creates a frame in which the viewer application can operate.
 */
public ViewerFrame(GraphicsConfiguration gc){
  super(gc);
  setTitle("Scene Viewer");
  setResizable(false);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  setBackground(Color.black);
  getContentPane().setBackground(Color.black);
  JMenu menuSettings=new JMenu("Settings");
  MenuUtil.addMenuItem(menuSettings,"Preferences",this,"handlePreferences");
  JMenuBar bar=new JMenuBar();
  bar.add(menuSettings);
  setJMenuBar(bar);
}
 

Example 14

From project niravCS2103, under directory /CS2103/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogBrokerMonitor.java

  22 
vote

protected JMenuBar createMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(createFileMenu());
  menuBar.add(createEditMenu());
  menuBar.add(createLogLevelMenu());
  menuBar.add(createViewMenu());
  menuBar.add(createConfigureMenu());
  menuBar.add(createHelpMenu());
  return (menuBar);
}
 

Example 15

From project oops, under directory /application/src/main/java/nl/rug/ai/mas/oops/.

Source file: GUI.java

  22 
vote

private JMenuBar buildMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(buildFileMenu());
  menuBar.add(buildRunMenu());
  return menuBar;
}
 

Example 16

From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/desk/.

Source file: MillFrameControl.java

  21 
vote

/** 
 * ---------------------------------------------- Instance Initialization ----------------------------------------------
 * @param mill  DOCUMENT ME!
 * @param name  DOCUMENT ME!
 */
public MillFrameControl(final Mill mill,final String name){
  eventspanelControl=new EventsPanelControl();
  this.mill=mill;
  frame=new MillFrame(name,getLogActiveStateView(),getLogStatus(),getTableStatus(),getEventsPanel(),getFilterSetView());
  frame.addInternalFrameListener(this);
  final JMenuBar menuBar=new JMenuBar();
  menuBar.add(getFilterSetMenu());
  menuBar.add(getColumnMenu());
  frame.setJMenuBar(menuBar);
  final BasicInternalFrameUI ui=(BasicInternalFrameUI)frame.getUI();
  final Component titlePanel=ui.getNorthPane();
  if (titlePanel == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("cannot add mouselistener to title panel, probably the " + "millframe isself is not used for visualisation");
    }
  }
 else {
    titlePanel.addMouseListener(new TitleListener());
  }
}
 

Example 17

From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.

Source file: DefaultTextView.java

  21 
vote

private JMenuBar createMenuBar(){
  JMenuBar bar=new JMenuBar();
  JMenu menu=new JMenu("Text",false);
  menu.setMnemonic('T');
  bar.add(menu);
  JMenuItem item=new JMenuItem("Save To Text File");
  item.addActionListener(this);
  item.setActionCommand("Save to text file");
  menu.add(item);
  menu.addSeparator();
  item=new JMenuItem("Save Changes");
  item.addActionListener(this);
  item.setActionCommand("Save changes");
  menu.add(item);
  menu.addSeparator();
  menu.addSeparator();
  item=new JMenuItem("Close");
  item.addActionListener(this);
  item.setActionCommand("Close");
  menu.add(item);
  return bar;
}
 

Example 18

From project glg2d, under directory /src/test/java/glg2d/.

Source file: UIDemo.java

  21 
vote

JComponent createMDIComponent(){
  JDesktopPane pane=new JDesktopPane();
  pane.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
  pane.setBackground(new JPanel().getBackground());
  pane.setOpaque(true);
  pane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
  for (int i=0; i < 3; i++) {
    JInternalFrame frame1=new JInternalFrame("Foo" + i,true);
    frame1.setClosable(true);
    frame1.setMaximizable(true);
    pane.add(frame1);
    JMenuBar bar=new JMenuBar();
    JMenu menu=new JMenu("File");
    menu.add(new JMenuItem("Open"));
    menu.add(new JMenuItem("Close"));
    bar.add(menu);
    frame1.setJMenuBar(bar);
    frame1.setSize(200,200);
    frame1.setLocation(100 * i,5 * i);
    frame1.setVisible(true);
  }
  return pane;
}
 

Example 19

From project GraduationProject, under directory /tesseract-android-tools/external/tesseract-3.00/java/com/google/scrollview/ui/.

Source file: SVMenuBar.java

  21 
vote

/** 
 * Create a new SVMenuBar and place it at the top of the ScrollView window.
 * @param scrollView The window our menubar belongs to.
 */
public SVMenuBar(SVWindow scrollView){
  root=new JMenuBar();
  svWindow=scrollView;
  items=new HashMap<String,SVAbstractMenuItem>();
  svWindow.setJMenuBar(root);
}
 

Example 20

From project harmony, under directory /harmony.ui.topologygui/src/main/java/org/opennaas/ui/topology/.

Source file: TopologyClient.java

  21 
vote

/** 
 * This method initializes jJMenuBar
 * @return javax.swing.JMenuBar
 */
private JMenuBar getJJMenuBar(){
  if (this.jJMenuBar == null) {
    this.jJMenuBar=new JMenuBar();
    this.jJMenuBar.add(this.getFileMenu());
    this.jJMenuBar.add(this.getHelpMenu());
  }
  return this.jJMenuBar;
}
 

Example 21

From project ib-ruby, under directory /misc/IBController 2-9-0/src/ibcontroller/.

Source file: Utils.java

  21 
vote

/** 
 * Traverse a container hierarchy and returns the first JMenuBar it finds.
 */
static JMenuBar findMenuBar(Container container){
  Component[] components=container.getComponents();
  for (  Component component : components) {
    if (component instanceof JMenuBar) {
      return (JMenuBar)component;
    }
 else     if (component instanceof Container) {
      JMenuBar jmb=findMenuBar((Container)component);
      if (jmb != null) {
        return jmb;
      }
    }
  }
  return null;
}
 

Example 22

From project jCAE, under directory /vtk-amibe-occ/src/org/jcae/vtk/test/.

Source file: TestVTK.java

  21 
vote

public static void main(String[] args){
  Utils.loadVTKLibraries();
  try {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
    JFrame frame=new JFrame();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JSplitPane split=new JSplitPane();
    vtkCanvas c1=createCanvas();
    split.add(c1,JSplitPane.BOTTOM);
    frame.add(split);
    JMenuBar bar=new JMenuBar();
    JMenu menu=new JMenu("File");
    menu.add(new JMenuItem("Open"));
    menu.add(new JMenuItem("Exit"));
    bar.add(menu);
    frame.add(bar,BorderLayout.NORTH);
    split.setDividerLocation(0.5);
    System.out.println(c1.getPreferredSize() + " " + c1.getMinimumSize());
    frame.setSize(800,600);
    split.setDividerLocation(0.5);
  }
 catch (  Exception ex) {
    Logger.getLogger(TestVTK.class.getName()).log(Level.SEVERE,null,ex);
  }
}
 

Example 23

From project jftp, under directory /src/main/java/com/myjavaworld/jftp/.

Source file: JFTP.java

  21 
vote

private JMenuBar prepareMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  FTPMenu menuFTP=new FTPMenu(this);
  LocalSystemMenu menuLocalSystem=new LocalSystemMenu(this);
  RemoteSystemMenu menuRemoteSystem=new RemoteSystemMenu(this);
  TransferModeMenu menuTransferTypes=new TransferModeMenu(this);
  ToolsMenu menuTools=new ToolsMenu(this);
  HelpMenu menuHelp=new HelpMenu(this);
  menuBar.add(menuFTP);
  menuBar.add(menuLocalSystem);
  menuBar.add(menuRemoteSystem);
  menuBar.add(menuTransferTypes);
  menuBar.add(menuTools);
  menuBar.add(menuHelp);
  return menuBar;
}
 

Example 24

From project joshua, under directory /src/joshua/ui/tree_visualizer/.

Source file: DerivationBrowser.java

  21 
vote

/** 
 * Creates the menu bar for the chooser frame. We put this in a seperate method so that it can be easily found and changed if need be.
 * @return the menu bar for the chooser frame
 */
private static JMenuBar createJMenuBar(){
  JMenuBar mb=new JMenuBar();
  JMenu openMenu=new JMenu("Control");
  JMenuItem creat=new JMenuItem("New tree viewer window");
  JMenuItem src=new JMenuItem("Open source file ...");
  JMenuItem tgt=new JMenuItem("Open n-best derivations file ...");
  JMenuItem quit=new JMenuItem("Quit");
  FileChoiceListener fcl=new FileChoiceListener(src,tgt);
  src.addActionListener(fcl);
  tgt.addActionListener(fcl);
  creat.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      activeFrame.disableNavigationButtons();
      activeFrame=new ActiveFrame();
      return;
    }
  }
);
  quit.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      System.exit(0);
    }
  }
);
  openMenu.add(creat);
  openMenu.add(src);
  openMenu.add(tgt);
  openMenu.add(quit);
  mb.add(openMenu);
  return mb;
}
 

Example 25

From project LateralGM, under directory /org/lateralgm/subframes/.

Source file: GameInformationFrame.java

  21 
vote

private JMenuBar makeMenuBar(){
  JMenuBar menuBar=new JMenuBar();
  JMenu menu=new JMenu(Messages.getString("GameInformationFrame.MENU_FILE"));
  menuBar.add(menu);
  menu.addActionListener(this);
  JMenuItem item=addItem("GameInformationFrame.LOAD");
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  item=addItem("GameInformationFrame.FILESAVE");
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  menu.addSeparator();
  item=addItem("GameInformationFrame.CLOSESAVE");
  menu.add(item);
  menu=new JMenu(Messages.getString("GameInformationFrame.MENU_EDIT"));
  menuBar.add(menu);
  item=new JMenuItem(undoManager.getUndoAction());
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  item=new JMenuItem(undoManager.getRedoAction());
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  menu.addSeparator();
  item=addItem("GameInformationFrame.CUT");
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  item=addItem("GameInformationFrame.COPY");
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  item=addItem("GameInformationFrame.PASTE");
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  menu.addSeparator();
  item=addItem("GameInformationFrame.SELECTALL");
  item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,KeyEvent.CTRL_DOWN_MASK));
  menu.add(item);
  return menuBar;
}
 

Example 26

From project litle-sdk-for-java, under directory /lib/xerces-2_11_0/samples/ui/.

Source file: TreeView.java

  21 
vote

/** 
 * Constructor
 */
public TreeView(String uri){
  super(uri);
  openFolder=DefaultImages.createOpenFolderImage();
  closedFolder=DefaultImages.createClosedFolderImage();
  leafImage=DefaultImages.createLeafImage();
  parser=new DOMParserSaveEncoding();
  ef=new ErrorStorer();
  fname=uri;
  JMenuBar jmb=new JMenuBar();
  JMenu fileMenu=new JMenu("File");
  JMenuItem item;
  item=new JMenuItem(openString);
  fileMenu.add(item);
  item.addActionListener(this);
  item=new JMenuItem(quitString);
  fileMenu.add(item);
  item.addActionListener(this);
  JMenu shortcutMenu=new JMenu("Shortcuts");
  item=new JMenuItem(expandString);
  shortcutMenu.add(item);
  item.addActionListener(this);
  item=new JMenuItem(collapseString);
  shortcutMenu.add(item);
  item.addActionListener(this);
  item=new JMenuItem(reloadString);
  shortcutMenu.add(item);
  item.addActionListener(this);
  jmb.add(fileMenu);
  jmb.add(shortcutMenu);
  setJMenuBar(jmb);
  getContentPane().add(createUI(fname));
}
 

Example 27

From project lpped, under directory /src/controller/.

Source file: GUI.java

  21 
vote

/** 
 * Initialize the menu bar used in the main window.
 * @return A {@code JMenuBar}
 */
private final JMenuBar initializeMenu(){
  final JMenuBar jmbMenu=new JMenuBar();
  final JMenu jmFile=new JMenu("File");
  final JMenu jmHelp=new JMenu("Help");
  jmFile.setMnemonic(KeyEvent.VK_F);
  jmHelp.setMnemonic(KeyEvent.VK_H);
  jmiExit=new JMenuItem("Exit");
  jmiAbout=new JMenuItem("About");
  jmiExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,KeyEvent.CTRL_DOWN_MASK));
  jmiAbout.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H,KeyEvent.CTRL_DOWN_MASK));
  jmbMenu.add(jmFile);
  jmbMenu.add(jmHelp);
  jmFile.add(jmiExit);
  jmHelp.add(jmiAbout);
  jmiExit.addActionListener(new exitListener());
  jmiAbout.addActionListener(new aboutListener());
  return jmbMenu;
}
 

Example 28

From project maple-ide, under directory /build/windows/launcher/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.

Source file: SimpleApp.java

  21 
vote

public SimpleApp(String[] args){
  super("Java Application");
  final int inset=100;
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  setBounds(inset,inset,screenSize.width - inset * 2,screenSize.height - inset * 2);
  JMenu menu=new JMenu("File");
  menu.add(new JMenuItem("Open"));
  menu.add(new JMenuItem("Save"));
  JMenuBar mb=new JMenuBar();
  mb.setOpaque(true);
  mb.add(menu);
  setJMenuBar(mb);
  this.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      System.exit(123);
    }
  }
);
  setVisible(true);
  StringBuffer sb=new StringBuffer("Java version: ");
  sb.append(System.getProperty("java.version"));
  sb.append("\nJava home: ");
  sb.append(System.getProperty("java.home"));
  sb.append("\nCurrent dir: ");
  sb.append(System.getProperty("user.dir"));
  if (args.length > 0) {
    sb.append("\nArgs: ");
    for (int i=0; i < args.length; i++) {
      sb.append(args[i]);
      sb.append(' ');
    }
  }
  JOptionPane.showMessageDialog(this,sb.toString(),"Info",JOptionPane.INFORMATION_MESSAGE);
}
 

Example 29

From project OpenLogViewer, under directory /src/main/java/org/diyefi/openlogviewer/propertypanel/.

Source file: PropertiesPane.java

  21 
vote

private JMenuBar createMenuBar(){
  final JMenuBar propMenuBar=new JMenuBar();
  final JMenu options=new JMenu(labels.getString(Text.OPTIONS_MENU_NAME));
  final JMenuItem addProperty=new JMenuItem(labels.getString(Text.OPTIONS_MENU_ITEM_ADD_PROPERTY_NAME));
  final JMenuItem removeProperty=new JMenuItem(labels.getString(Text.OPTIONS_MENU_ITEM_REMOVE_PROPERTIES_NAME));
  propMenuBar.add(options);
  addProperty.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent evt){
      final String s=(String)JOptionPane.showInputDialog(rootPane,labels.getString(Text.ENTER_HEADER_FOR_PROPERTY));
      if (StringUtils.isNotBlank(s)) {
        final SingleProperty newprop=new SingleProperty();
        newprop.setHeader(s);
        addProperty(newprop);
      }
    }
  }
);
  removeProperty.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent evt){
      removePropertyPanels();
    }
  }
);
  options.add(addProperty);
  options.add(removeProperty);
  return propMenuBar;
}
 

Example 30

From project packetsamurai, under directory /src/com/l2j/packetsamurai/gui/protocoleditor/.

Source file: ProtocolEditor.java

  21 
vote

public ProtocolEditor(JFrame frame){
  super(frame);
  setTitle("Packet Samurai - Protocol Editor");
  setSize(800,600);
  setLayout(new BorderLayout());
  _clientTab=new ProtocolTab();
  _serverTab=new ProtocolTab();
  JMenuBar menuBar=new JMenuBar();
  _pel=new ProtocolEditorListener(this);
  JMenu fileMenu=new JMenu("File");
  JMenuItem reloadButton=new JMenuItem("Reload");
  reloadButton.setActionCommand("reload");
  reloadButton.addActionListener(_pel);
  JMenuItem saveButton=new JMenuItem("Save");
  saveButton.setActionCommand("save");
  saveButton.addActionListener(_pel);
  fileMenu.add(reloadButton);
  fileMenu.add(saveButton);
  _protocolMenu=new JMenu("Chose Protocol");
  loadProtocols();
  JMenu editMenu=new JMenu("Edit");
  JMenuItem protoPorpertyButton=new JMenuItem("Protocol Properties");
  protoPorpertyButton.setActionCommand("properties");
  protoPorpertyButton.addActionListener(_pel);
  editMenu.add(protoPorpertyButton);
  menuBar.add(fileMenu);
  menuBar.add(_protocolMenu);
  menuBar.add(editMenu);
  setJMenuBar(menuBar);
  JTabbedPane tabPane=new JTabbedPane();
  tabPane.add(_clientTab);
  tabPane.add(_serverTab);
  add(tabPane);
}
 

Example 31

From project RomRaider, under directory /3rdparty/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.

Source file: SimpleApp.java

  21 
vote

public SimpleApp(String[] args){
  super("Java Application");
  final int inset=100;
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  setBounds(inset,inset,screenSize.width - inset * 2,screenSize.height - inset * 2);
  JMenu menu=new JMenu("File");
  menu.add(new JMenuItem("Open"));
  menu.add(new JMenuItem("Save"));
  JMenuBar mb=new JMenuBar();
  mb.setOpaque(true);
  mb.add(menu);
  setJMenuBar(mb);
  this.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      System.exit(123);
    }
  }
);
  setVisible(true);
  StringBuffer sb=new StringBuffer("Java version: ");
  sb.append(System.getProperty("java.version"));
  sb.append("\nJava home: ");
  sb.append(System.getProperty("java.home"));
  sb.append("\nCurrent dir: ");
  sb.append(System.getProperty("user.dir"));
  if (args.length > 0) {
    sb.append("\nArgs: ");
    for (int i=0; i < args.length; i++) {
      sb.append(args[i]);
      sb.append(' ');
    }
  }
  JOptionPane.showMessageDialog(this,sb.toString(),"Info",JOptionPane.INFORMATION_MESSAGE);
}
 

Example 32

From project rpiplanner, under directory /src/rpiplanner/.

Source file: Main.java

  21 
vote

private void initializeMenuBar(){
  final JMenuBar menu=new JMenuBar();
  final JMenu fileMenu=new JMenu("Plan");
  fileMenu.add(getAction("savePlan"));
  fileMenu.add(getAction("loadPlan"));
  fileMenu.add(getAction("newPlan"));
  fileMenu.add(getAction("print"));
  fileMenu.add(getAction("details"));
  final JMenu helpMenu=new JMenu("Help");
  helpMenu.add(getAction("feedback"));
  helpMenu.add(getAction("about"));
  final JMenuItem fileUpdate=new JMenuItem("Update from course database");
  fileUpdate.addActionListener(new ActionListener(){
    public void actionPerformed(    final ActionEvent e){
      planControl.updatePlanFromDatabase();
    }
  }
);
  fileMenu.add(fileUpdate);
  menu.add(fileMenu);
  menu.add(helpMenu);
  mainFrame.setJMenuBar(menu);
}
 

Example 33

From project ScissLib, under directory /src/main/java/de/sciss/common/.

Source file: SmartJFrame.java

  21 
vote

protected void checkMenuBar(ContainerEvent e){
  final JMenuBar mb=(JMenuBar)e.getContainer();
  if (mb.getMenuCount() == 0) {
    if (getJMenuBar() == mb) {
      super.setJMenuBar(null);
    }
  }
 else {
    if (getJMenuBar() == null) {
      super.setJMenuBar(mb);
    }
  }
  final JRootPane rp=getRootPane();
  rp.revalidate();
  rp.repaint();
}
 

Example 34

From project sgl-Editor, under directory /src/de/moonshade/osbe/gui/.

Source file: DefaultGUI.java

  21 
vote

private JMenuBar getMenuBar(){
  if (menuBar == null) {
    menuBar=new JMenuBar();
  }
  return menuBar;
}
 

Example 35

From project SPREAD, under directory /release/tools/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.

Source file: SimpleApp.java

  21 
vote

public SimpleApp(String[] args){
  super("Java Application");
  final int inset=100;
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  setBounds(inset,inset,screenSize.width - inset * 2,screenSize.height - inset * 2);
  JMenu menu=new JMenu("File");
  menu.add(new JMenuItem("Open"));
  menu.add(new JMenuItem("Save"));
  JMenuBar mb=new JMenuBar();
  mb.setOpaque(true);
  mb.add(menu);
  setJMenuBar(mb);
  this.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      System.exit(123);
    }
  }
);
  setVisible(true);
  StringBuffer sb=new StringBuffer("Java version: ");
  sb.append(System.getProperty("java.version"));
  sb.append("\nJava home: ");
  sb.append(System.getProperty("java.home"));
  sb.append("\nCurrent dir: ");
  sb.append(System.getProperty("user.dir"));
  if (args.length > 0) {
    sb.append("\nArgs: ");
    for (int i=0; i < args.length; i++) {
      sb.append(args[i]);
      sb.append(' ');
    }
  }
  JOptionPane.showMessageDialog(this,sb.toString(),"Info",JOptionPane.INFORMATION_MESSAGE);
}
 

Example 36

From project SwingOSC, under directory /src/main/java/de/sciss/swingosc/.

Source file: Application.java

  21 
vote

protected BasicMenuFactory createMenuFactory(){
  return new BasicMenuFactory(this){
    public void addMenuItems(){
      remove(get("file"));
      remove(get("edit"));
      remove(get("window"));
      remove(get("help"));
    }
    public void showPreferences(){
    }
    public void openDocument(    File f){
    }
    public Action getOpenAction(){
      return null;
    }
    @Override protected JComponent createComponent(    Action a){
      final JMenuBar mb=new JMenuBar();
      if (aquaMenuBarUI != null) {
        mb.setUI(aquaMenuBarUI);
      }
      return mb;
    }
  }
;
}
 

Example 37

From project thinklab, under directory /src/main/java/org/integratedmodelling/thinklab/visualization/.

Source file: Picture.java

  21 
vote

/** 
 * @wbp.parser.entryPoint
 */
public void show(){
  if (frame == null) {
    frame=new JFrame();
    JMenuBar menuBar=new JMenuBar();
    JMenu menu=new JMenu("File");
    menuBar.add(menu);
    JMenuItem menuItem1=new JMenuItem(" Save...   ");
    menuItem1.addActionListener(this);
    menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menu.add(menuItem1);
    frame.setJMenuBar(menuBar);
    frame.setContentPane(getJLabel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setTitle("Picture Frame");
    frame.setResizable(false);
    frame.pack();
    frame.setVisible(true);
  }
  frame.repaint();
}
 

Example 38

From project tika, under directory /tika-app/src/main/java/org/apache/tika/gui/.

Source file: TikaGUI.java

  21 
vote

private void addMenuBar(){
  JMenuBar bar=new JMenuBar();
  JMenu file=new JMenu("File");
  file.setMnemonic(KeyEvent.VK_F);
  addMenuItem(file,"Open...","openfile",KeyEvent.VK_O);
  addMenuItem(file,"Open URL...","openurl",KeyEvent.VK_U);
  file.addSeparator();
  addMenuItem(file,"Exit","exit",KeyEvent.VK_X);
  bar.add(file);
  JMenu view=new JMenu("View");
  view.setMnemonic(KeyEvent.VK_V);
  addMenuItem(view,"Metadata","metadata",KeyEvent.VK_M);
  addMenuItem(view,"Formatted text","html",KeyEvent.VK_F);
  addMenuItem(view,"Plain text","text",KeyEvent.VK_P);
  addMenuItem(view,"Main content","main",KeyEvent.VK_C);
  addMenuItem(view,"Structured text","xhtml",KeyEvent.VK_S);
  bar.add(view);
  bar.add(Box.createHorizontalGlue());
  JMenu help=new JMenu("Help");
  help.setMnemonic(KeyEvent.VK_H);
  addMenuItem(help,"About Tika","about",KeyEvent.VK_A);
  bar.add(help);
  setJMenuBar(bar);
}
 

Example 39

From project TraVis, under directory /src/travis/view/.

Source file: MainFrame.java

  21 
vote

public MainFrame(){
  super(Messages.get("app.name"));
  this.setLayout(new MigLayout("fill, hidemode 2"));
  this.setBackground(Color.WHITE);
  menuBar=new JMenuBar();
  tabbedPane=new JTabbedPane();
  setupMenuBar();
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setMinimumSize(new Dimension(1125,600));
  Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
  this.setPreferredSize(d);
  this.pack();
}
 

Example 40

From project treeGenerator, under directory /arbaro_1_9_8/src/net/sourceforge/arbaro/gui/.

Source file: Workplace.java

  21 
vote

void createMenuBar(){
  JMenuBar menubar;
  JMenu menu;
  JMenuItem item;
  menubar=new JMenuBar();
  menu=new JMenu("File");
  menu.setMnemonic('F');
  item=new JMenuItem(fileNewAction);
  menu.add(item);
  item=new JMenuItem(fileOpenAction);
  menu.add(item);
  item=new JMenuItem(fileSaveAction);
  menu.add(item);
  item=new JMenuItem(new FileSaveAsAction());
  menu.add(item);
  menu.add(new JSeparator());
  item=new JMenuItem(exportTreeAction);
  menu.add(item);
  item=new JMenuItem(renderTreeAction);
  menu.add(item);
  menu.add(new JSeparator());
  item=new JMenuItem(quitAction);
  menu.add(item);
  menubar.add(menu);
  menu=new JMenu("Setup");
  menu.setMnemonic('S');
  item=new JMenuItem(new SetupArbaroAction());
  menu.add(item);
  menubar.add(menu);
  menu=new JMenu("Help");
  menu.setMnemonic('H');
  item=new JMenuItem(new HelpAboutAction());
  menu.add(item);
  menubar.add(menu);
  frame.setJMenuBar(menubar);
}
 

Example 41

From project Wiring, under directory /IDE/processing/app/macosx/.

Source file: ThinkDifferent.java

  21 
vote

static protected void init(Base base){
  if (application == null) {
    application=Application.getApplication();
  }
  if (adapter == null) {
    adapter=new ThinkDifferent(base);
  }
  application.addApplicationListener(adapter);
  application.setEnabledAboutMenu(true);
  application.setEnabledPreferencesMenu(true);
  try {
    Class<?> appClass=Application.class;
    Method method=appClass.getMethod("setDefaultMenuBar",new Class[]{JMenuBar.class});
    if (method != null) {
      JMenuBar defaultMenuBar=new JMenuBar();
      JMenu fileMenu=base.buildFileMenu(null);
      defaultMenuBar.add(fileMenu);
      method.invoke(application,new Object[]{defaultMenuBar});
      Base.defaultFileMenu=fileMenu;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 42

From project LanguageSpecCreator, under directory /src/SpecificationCreation/.

Source file: SpecificationCreator.java

  20 
vote

/** 
 * Creates the initial welcome and starting screen
 */
private void init(Container c){
  topMenu=new JMenuBar();
  JMenu fileMenu=new JMenu("File");
  fileMenu.setMnemonic(KeyEvent.VK_ALT);
  topMenu.add(fileMenu);
  newItem=new JMenuItem("New project",KeyEvent.VK_N);
  newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,ActionEvent.CTRL_MASK));
  newItem.addActionListener(this);
  fileMenu.add(newItem);
  openItem=new JMenuItem("Open project",KeyEvent.VK_O);
  openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,ActionEvent.CTRL_MASK));
  openItem.addActionListener(this);
  fileMenu.add(openItem);
  saveItem=new JMenuItem("Save project",KeyEvent.VK_S);
  saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,ActionEvent.CTRL_MASK));
  saveItem.addActionListener(this);
  fileMenu.add(saveItem);
  exitItem=new JMenuItem("Exit",KeyEvent.VK_Q);
  exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,ActionEvent.CTRL_MASK));
  exitItem.addActionListener(this);
  fileMenu.add(exitItem);
  setJMenuBar(topMenu);
  GridBagConstraints constraint=new GridBagConstraints();
  JTextArea area=new JTextArea("Welcome to the LIBER ontology preparation tool. " + "Please open an existing project, or start a new project by uploading the ontology you wish to adapt for use in LIBER.");
  area.setEditable(false);
  area.setLineWrap(true);
  area.setWrapStyleWord(true);
  constraint.insets=new Insets(0,10,10,0);
  constraint.anchor=GridBagConstraints.CENTER;
  constraint.gridx=0;
  constraint.gridy=0;
  c.add(area,constraint);
}
 

Example 43

From project freemind, under directory /freemind/freemind/controller/.

Source file: StructuredMenuHolder.java

  19 
vote

public void updateMenus(final JMenuBar myItem,String prefix){
  MapTokenPair pair=getCategoryMap(new StringTokenizer(prefix,"/"),menuMap);
  Map myMap=(Map)pair.map.get(pair.token);
  updateMenus(new MenuAdder(){
    public void addMenuItem(    StructuredMenuItemHolder holder){
      Tools.setLabelAndMnemonic(holder.getMenuItem(),null);
      myItem.add(holder.getMenuItem());
    }
    public void addSeparator(){
      throw new NoSuchMethodError("addSeparator for JMenuBar");
    }
    public void addCategory(    String category){
    }
  }
,myMap,new DefaultMenuAdderCreator());
}
 

Example 44

From project jASM_16, under directory /src/main/java/de/codesourcery/jasm16/ide/ui/.

Source file: MenuManager.java

  19 
vote

public JMenuBar getMenuBar(){
synchronized (menuBarLock) {
    if (menuBar == null) {
      menuBar=createMenuBar();
      if (watchdogThread == null || !watchdogThread.isAlive()) {
        watchdogThread=new ItemWatchdog();
        watchdogThread.start();
      }
 else {
        watchdogThread.clearCache();
      }
    }
    return menuBar;
  }
}
 

Example 45

From project jgraphx, under directory /examples/com/mxgraph/examples/swing/editor/.

Source file: BasicGraphEditor.java

  19 
vote

/** 
 */
public JFrame createFrame(JMenuBar menuBar){
  JFrame frame=new JFrame();
  frame.getContentPane().add(this);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setJMenuBar(menuBar);
  frame.setSize(870,640);
  updateTitle();
  return frame;
}