예제 #1
0
 /// <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();
 }
예제 #2
0
        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);
        }
예제 #3
0
		public JSConsole(string[] args) : base("Rhino JavaScript Console")
		{
			JMenuBar menubar = new JMenuBar();
			CreateFileChooser();
			string[] fileItems = new string[] { "Load...", "Exit" };
			string[] fileCmds = new string[] { "Load", "Exit" };
			char[] fileShortCuts = new char[] { 'L', 'X' };
			string[] editItems = new string[] { "Cut", "Copy", "Paste" };
			char[] editShortCuts = new char[] { 'T', 'C', 'P' };
			string[] plafItems = new string[] { "Metal", "Windows", "Motif" };
			bool[] plafState = new bool[] { true, false, false };
			JMenu fileMenu = new JMenu("File");
			fileMenu.SetMnemonic('F');
			JMenu editMenu = new JMenu("Edit");
			editMenu.SetMnemonic('E');
			JMenu plafMenu = new JMenu("Platform");
			plafMenu.SetMnemonic('P');
			for (int i = 0; i < fileItems.Length; ++i)
			{
				JMenuItem item = new JMenuItem(fileItems[i], fileShortCuts[i]);
				item.SetActionCommand(fileCmds[i]);
				item.AddActionListener(this);
				fileMenu.Add(item);
			}
			for (int i_1 = 0; i_1 < editItems.Length; ++i_1)
			{
				JMenuItem item = new JMenuItem(editItems[i_1], editShortCuts[i_1]);
				item.AddActionListener(this);
				editMenu.Add(item);
			}
			ButtonGroup group = new ButtonGroup();
			for (int i_2 = 0; i_2 < plafItems.Length; ++i_2)
			{
				JRadioButtonMenuItem item = new JRadioButtonMenuItem(plafItems[i_2], plafState[i_2]);
				group.Add(item);
				item.AddActionListener(this);
				plafMenu.Add(item);
			}
			menubar.Add(fileMenu);
			menubar.Add(editMenu);
			menubar.Add(plafMenu);
			SetJMenuBar(menubar);
			consoleTextArea = new ConsoleTextArea(args);
			JScrollPane scroller = new JScrollPane(consoleTextArea);
			SetContentPane(scroller);
			consoleTextArea.SetRows(24);
			consoleTextArea.SetColumns(80);
			AddWindowListener(new _WindowAdapter_135());
			Pack();
			SetVisible(true);
			// System.setIn(consoleTextArea.getIn());
			// System.setOut(consoleTextArea.getOut());
			// System.setErr(consoleTextArea.getErr());
			Program.SetIn(consoleTextArea.GetIn());
			Program.SetOut(consoleTextArea.GetOut());
			Program.SetErr(consoleTextArea.GetErr());
			Program.Main(args);
		}
예제 #4
0
        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);
        }