/// <summary> /// This method is called from within the constructor to /// initialize the form. /// </summary> /// <remarks> /// This method is called from within the constructor to /// initialize the form. /// WARNING: Do NOT modify this code. The content of this method is /// always regenerated by the Form Editor. /// </remarks> private void InitComponents() { //GEN-BEGIN:initComponents jMenuBar1 = new JMenuBar(); jMenu1 = new JMenu(); loadDataItem = new JMenuItem(); loadParserItem = new JMenuItem(); jSeparator1 = new JSeparator(); exitItem = new JMenuItem(); jMenu2 = new JMenu(); untokEngItem = new JCheckBoxMenuItem(); tokChineseItem = new JCheckBoxMenuItem(); untokChineseItem = new JCheckBoxMenuItem(); SetTitle("Parser"); AddWindowListener(new _WindowAdapter_92(this)); jMenu1.SetText("File"); loadDataItem.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkO, InputEvent.AltMask)); loadDataItem.SetMnemonic('o'); loadDataItem.SetText("Load File"); loadDataItem.SetToolTipText("Load a data file."); loadDataItem.AddActionListener(null); jMenu1.Add(loadDataItem); loadParserItem.SetText("Load Parser"); loadParserItem.AddActionListener(null); jMenu1.Add(loadParserItem); jMenu1.Add(jSeparator1); exitItem.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkX, InputEvent.AltMask)); exitItem.SetMnemonic('x'); exitItem.SetText("Exit"); exitItem.SetToolTipText("Exits the program."); exitItem.AddActionListener(null); jMenu1.Add(exitItem); jMenuBar1.Add(jMenu1); SetJMenuBar(jMenuBar1); Pack(); }
private JMenuBar AddMenuBar() { JMenuBar menubar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); menubar.Add(fileMenu); JMenu editMenu = new JMenu("Edit"); menubar.Add(editMenu); JMenu classifierMenu = new JMenu("Classifier"); menubar.Add(classifierMenu); int menuMask = Toolkit.GetDefaultToolkit().GetMenuShortcutKeyMask(); /* * FILE MENU */ JMenuItem openFile = new JMenuItem("Open File"); openFile.SetMnemonic('O'); openFile.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkF, menuMask)); openFile.AddActionListener(actor); fileMenu.Add(openFile); JMenuItem loadURL = new JMenuItem("Load URL"); loadURL.SetMnemonic('L'); loadURL.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkU, menuMask)); loadURL.AddActionListener(actor); fileMenu.Add(loadURL); fileMenu.Add(new JSeparator()); saveUntagged = new JMenuItem("Save Untagged File"); saveUntagged.SetMnemonic('S'); saveUntagged.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkS, menuMask)); saveUntagged.AddActionListener(actor); saveUntagged.SetEnabled(false); fileMenu.Add(saveUntagged); JMenuItem saveUntaggedAs = new JMenuItem("Save Untagged File As ..."); saveUntaggedAs.SetMnemonic('U'); saveUntaggedAs.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkU, menuMask)); saveUntaggedAs.AddActionListener(actor); fileMenu.Add(saveUntaggedAs); saveTaggedAs = new JMenuItem("Save Tagged File As ..."); saveTaggedAs.SetMnemonic('T'); saveTaggedAs.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkT, menuMask)); saveTaggedAs.AddActionListener(actor); saveTaggedAs.SetEnabled(false); fileMenu.Add(saveTaggedAs); fileMenu.Add(new JSeparator()); JMenuItem exit = new JMenuItem("Exit"); exit.SetMnemonic('x'); exit.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkQ, menuMask)); exit.AddActionListener(actor); fileMenu.Add(exit); /* * EDIT MENU */ JMenuItem clear = new JMenuItem("Clear"); clear.SetMnemonic('C'); clear.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkL, menuMask)); clear.AddActionListener(actor); editMenu.Add(clear); /* * CLASSIFIER MENU */ JMenuItem loadCRF = new JMenuItem("Load CRF From File"); loadCRF.SetMnemonic('R'); loadCRF.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkR, menuMask)); loadCRF.AddActionListener(actor); classifierMenu.Add(loadCRF); JMenuItem loadDefaultCRF = new JMenuItem("Load Default CRF"); loadDefaultCRF.SetMnemonic('L'); loadDefaultCRF.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkL, menuMask)); loadDefaultCRF.AddActionListener(actor); classifierMenu.Add(loadDefaultCRF); JMenuItem loadCMM = new JMenuItem("Load CMM From File"); loadCMM.SetMnemonic('M'); loadCMM.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkM, menuMask)); loadCMM.AddActionListener(actor); classifierMenu.Add(loadCMM); JMenuItem loadDefaultCMM = new JMenuItem("Load Default CMM"); loadDefaultCMM.SetMnemonic('D'); loadDefaultCMM.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkD, menuMask)); loadDefaultCMM.AddActionListener(actor); classifierMenu.Add(loadDefaultCMM); return(menubar); }
private JMenuBar AddMenuBar() { JMenuBar menubar = new JMenuBar(); int shortcutMask = Toolkit.GetDefaultToolkit().GetMenuShortcutKeyMask(); int shiftShortcutMask = Toolkit.GetDefaultToolkit().GetMenuShortcutKeyMask() | InputEvent.ShiftDownMask; JMenu fileMenu = new JMenu("File"); menubar.Add(fileMenu); JMenu editMenu = new JMenu("Edit"); menubar.Add(editMenu); JMenu classifierMenu = new JMenu("Classifier"); menubar.Add(classifierMenu); /* * FILE MENU */ JMenuItem openFile = new JMenuItem("Open File"); openFile.SetMnemonic('O'); openFile.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkO, shortcutMask)); openFile.AddActionListener(actor); fileMenu.Add(openFile); JMenuItem loadURL = new JMenuItem("Load URL"); loadURL.SetMnemonic('L'); loadURL.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkU, shortcutMask)); loadURL.AddActionListener(actor); fileMenu.Add(loadURL); fileMenu.Add(new JSeparator()); saveUntagged = new JMenuItem("Save Untagged File"); saveUntagged.SetMnemonic('S'); saveUntagged.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkS, shortcutMask)); saveUntagged.AddActionListener(actor); saveUntagged.SetEnabled(false); fileMenu.Add(saveUntagged); JMenuItem saveUntaggedAs = new JMenuItem("Save Untagged File As ..."); saveUntaggedAs.SetMnemonic('U'); saveUntaggedAs.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkS, shiftShortcutMask)); saveUntaggedAs.AddActionListener(actor); fileMenu.Add(saveUntaggedAs); saveTaggedAs = new JMenuItem("Save Tagged File As ..."); saveTaggedAs.SetMnemonic('T'); saveTaggedAs.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkT, shortcutMask)); saveTaggedAs.AddActionListener(actor); saveTaggedAs.SetEnabled(false); fileMenu.Add(saveTaggedAs); if (!IsMacOSX()) { // don't need if on Mac, since it has its own Quit on application menu! fileMenu.Add(new JSeparator()); JMenuItem exit = new JMenuItem("Exit"); exit.SetMnemonic('x'); exit.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkQ, shortcutMask)); exit.AddActionListener(actor); fileMenu.Add(exit); } /* * EDIT MENU */ JMenuItem cut = new JMenuItem("Cut"); cut.SetMnemonic('X'); cut.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkX, shortcutMask)); cut.AddActionListener(actor); editMenu.Add(cut); JMenuItem copy = new JMenuItem("Copy"); copy.SetMnemonic('C'); copy.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkC, shortcutMask)); copy.AddActionListener(actor); editMenu.Add(copy); JMenuItem paste = new JMenuItem("Paste"); paste.SetMnemonic('V'); paste.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkV, shortcutMask)); paste.AddActionListener(actor); editMenu.Add(paste); JMenuItem clear = new JMenuItem("Clear"); clear.SetMnemonic('C'); // clear.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, shortcutMask)); // used for load CRF clear.AddActionListener(actor); editMenu.Add(clear); /* * CLASSIFIER MENU */ JMenuItem loadCRF = new JMenuItem("Load CRF from File"); loadCRF.SetMnemonic('R'); loadCRF.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkR, shortcutMask)); loadCRF.AddActionListener(actor); classifierMenu.Add(loadCRF); JMenuItem loadResourceCRF = new JMenuItem("Load CRF from Classpath"); // loadCRF.setMnemonic('R'); // loadCRF.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, shortcutMask)); loadResourceCRF.AddActionListener(actor); classifierMenu.Add(loadResourceCRF); JMenuItem loadDefaultCRF = new JMenuItem("Load Default CRF"); loadDefaultCRF.SetMnemonic('L'); loadDefaultCRF.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkL, shortcutMask)); loadDefaultCRF.AddActionListener(actor); classifierMenu.Add(loadDefaultCRF); extract = new JMenuItem("Run NER"); extract.SetMnemonic('N'); extract.SetAccelerator(KeyStroke.GetKeyStroke(KeyEvent.VkN, shortcutMask)); extract.AddActionListener(actor); classifierMenu.Add(extract); return(menubar); }