comparison test/editortest/REPTextWithJTextArea.java @ 419:7ff127c8ad64

(no commit message)
author one
date Tue, 20 Jan 2009 18:39:02 +0900
parents 267f9748e826
children
comparison
equal deleted inserted replaced
418:d1bfcff0cdd2 419:7ff127c8ad64
9 import javax.swing.JTextArea; 9 import javax.swing.JTextArea;
10 import javax.swing.JTextField; 10 import javax.swing.JTextField;
11 import javax.swing.event.DocumentEvent; 11 import javax.swing.event.DocumentEvent;
12 import javax.swing.event.DocumentListener; 12 import javax.swing.event.DocumentListener;
13 import javax.swing.text.BadLocationException; 13 import javax.swing.text.BadLocationException;
14
15 import rep.REPCommand;
14 16
15 public class REPTextWithJTextArea implements REPText, DocumentListener, ActionListener { 17 public class REPTextWithJTextArea implements REPText, DocumentListener, ActionListener {
16 18
17 private JTextArea textArea; 19 private JTextArea textArea;
18 private String BR = System.getProperty("line.separator"); 20 private String BR = System.getProperty("line.separator");
150 insert(lineno, text); 152 insert(lineno, text);
151 for(REPTextListener listener : textListenerList){ 153 for(REPTextListener listener : textListenerList){
152 listener.textInserted(new REPTextEvent(lineno, text)); 154 listener.textInserted(new REPTextEvent(lineno, text));
153 } 155 }
154 } 156 }
157
158 public void userInsert(REPCommand command) {
159 int lineno = command.lineno;
160 String text = command.string;
161 insert(lineno, text);
162 for(REPTextListener listener : textListenerList){
163 listener.textInserted(new REPTextEvent(lineno, text));
164 }
165 }
155 166
156 } 167 }