47 |
import java.beans.PropertyChangeListener; |
import java.beans.PropertyChangeListener; |
48 |
|
|
49 |
import javax.accessibility.AccessibleStateSet; |
import javax.accessibility.AccessibleStateSet; |
50 |
|
import javax.swing.text.AttributeSet; |
51 |
|
import javax.swing.text.BadLocationException; |
52 |
import javax.swing.text.Document; |
import javax.swing.text.Document; |
53 |
import javax.swing.text.JTextComponent; |
import javax.swing.text.JTextComponent; |
54 |
import javax.swing.text.PlainDocument; |
import javax.swing.text.PlainDocument; |
189 |
*/ |
*/ |
190 |
protected Document createDefaultModel() |
protected Document createDefaultModel() |
191 |
{ |
{ |
192 |
return new PlainDocument(); |
// subclassed to swallow newlines |
193 |
|
return new PlainDocument() { |
194 |
|
public void insertString(int offset, String str, AttributeSet a) |
195 |
|
throws BadLocationException |
196 |
|
{ |
197 |
|
if (str.indexOf('\n') == -1) |
198 |
|
super.insertString(offset, str, a); |
199 |
|
} |
200 |
|
}; |
201 |
} |
} |
202 |
|
|
203 |
/** |
/** |