예제 #1
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);
		}