我用jbuilder7,建立了一个JTextArea的对象jta,在jta里头找不到addTextListener方法。我已经import java.awt.event.*;也已经implements TextListener和写了一个textValueChanged方法。但是jta.addTextListener(this);却不可以,我缺了点什么没有做吗?!
调试欢乐多
* a <code>TextListener</code> for <code>TextEvent</code>s.
* In the <code>JTextComponent</code> based
* components, changes are broadcasted from the model via a
* <code>DocumentEvent</code> to <code>DocumentListeners</code>.
* The <code>DocumentEvent</code> gives
* the location of the change and the kind of change if desired.
* The code fragment might look something like:
* <pre>
* DocumentListener myListener = ??;
* JTextArea myArea = ??;
* myArea.getDocument().addDocumentListener(myListener);
* </pre>
* <p>
* For the keyboard keys used by this component in the standard Look and
* Feel (L&F) renditions, see the
* <a href="doc-files/Key-Index.html#JTextArea"><code>JTextArea</code> key assignments</a>.
JTextArea use DocumentListener
我现在已经改用按钮事件做发送了,不过我还是想知道有没有可能实时传输呢?!