PageRenderTime 131ms CodeModel.GetById 128ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/bsh/commands/editor.bsh

#
Unknown | 41 lines | 33 code | 8 blank | 0 comment | 0 complexity | 98b84d206175a7b67bdb36f2f01a0bbf MD5 | raw file
 1
 2bsh.help.editor = "usage: editor()";
 3import java.awt.*;
 4
 5editor() {
 6	if ( bsh.system.desktop != void ) {
 7		return workspaceEditor( this.interpreter );
 8	}
 9
10	ta = new TextArea(15,40);
11	frame = new Frame("Editor");
12	frame.add(ta, "Center");
13
14	p = new Panel();
15	b = new Button("Eval");
16	b.addActionListener(this);
17	p.add(b);
18	b = new Button("Clear");
19	b.addActionListener(this);
20	p.add(b);
21	b = new Button("Close");
22	b.addActionListener(this);
23	p.add(b);
24
25	frame.add(p, "South");
26	frame.pack();
27	frame.show();
28
29	actionPerformed(e) {
30		if ( e.getActionCommand().equals("Close") )
31			frame.dispose();
32		else if ( e.getActionCommand().equals("Clear") )
33			ta.setText("");
34		else
35			this.interpreter.eval( ta.getText() );
36	}
37
38	print("Editor started...");
39	return frame;
40}
41