source: trunk/j/src/bsh/commands/editor.bsh @ 2

Last change on this file since 2 was 2, checked in by piso, 18 years ago

Initial checkin.

File size: 766 bytes
Line 
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
Note: See TracBrowser for help on using the repository browser.