PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. bsh.help.editor = "usage: editor()";
  2. import java.awt.*;
  3. editor() {
  4. if ( bsh.system.desktop != void ) {
  5. return workspaceEditor( this.interpreter );
  6. }
  7. ta = new TextArea(15,40);
  8. frame = new Frame("Editor");
  9. frame.add(ta, "Center");
  10. p = new Panel();
  11. b = new Button("Eval");
  12. b.addActionListener(this);
  13. p.add(b);
  14. b = new Button("Clear");
  15. b.addActionListener(this);
  16. p.add(b);
  17. b = new Button("Close");
  18. b.addActionListener(this);
  19. p.add(b);
  20. frame.add(p, "South");
  21. frame.pack();
  22. frame.show();
  23. actionPerformed(e) {
  24. if ( e.getActionCommand().equals("Close") )
  25. frame.dispose();
  26. else if ( e.getActionCommand().equals("Clear") )
  27. ta.setText("");
  28. else
  29. this.interpreter.eval( ta.getText() );
  30. }
  31. print("Editor started...");
  32. return frame;
  33. }