Does anyone know the appropriate syntax for a TextListener. I am trying to add a textListener to a JTextArea but keep getting the following error message:-
ATM.java:75: cannot find symbol
symbol : method addTextListener()
location: class javax.swing.JTextArea
Any help would be appreciated. I have the addTextListner method within my class, so I dont think this is causing a problem.
are you sure you didn't mean addDocumentListener? There's no such thing as a textlistener or an addTextListener method for JTextArea.
When in doubt, read the API.
Thanks for the reply. I did mean TextListener, it is listed on page 335 of sams teach yourself java 6, and on some sites that I have looked at. I will look at addDocumentListener(), it might be helpful.
I don't doubt that page 335 mentions this, but are you sure that it mentions it in reference to JTextAreas? I think that you may be mixing up Swing and AWT here as TextListeners are used with the AWT component TextArea but not with the Swing component JTextArea. Right now I'm standing by your need to use a DocumentListener here not a TextListener, but please look at the fine print of that article and get back to me if I'm wrong.