aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes TextAreaHandler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TextAreaHandler" Watch "TextAreaHandler" New topic
Author

TextAreaHandler

jyothi godavarthy
Ranch Hand

Joined: Jan 28, 2004
Posts: 135
hi, could anyone help me with this code as I am getting compiler error that no addActionListener method in TextAreaHandler class.
Thanks.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class TextArea extends JFrame {
JTextArea t;
public TextArea(){
super("Testing TextBox");
Container c= getContentPane();
c.setLayout(new FlowLayout());
t=new JTextArea(20,12);
t.setBackground(Color.cyan);
t.setFont(new Font("TimesRoman",Font.ITALIC,24));
t.setToolTipText("this is a TextBox");
t.setText("type here");
c.add(t);

TextAreaHandler handler=new TextAreaHandler();
t.addActionListener(handler);
setSize(325,100);
show();
}
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I've never heard of a "TextAreaHandler" class - it isn't in the standard jdk as of version 1.3, and you don't show any source code for it, so I have no idea what it does. Probably your compiler doesn't know either. On the other hand, there is a class called "TextArea" already in the java.awt package, so it's probably a bad idea to create a new class with that name, as you are doing.
As for the code "t.addActionListener(handler)": t has been declared as a JTextComponent. If you read the API, a JTextComponent does not have any addActionListener method. It has many other listeners, but ActionListener is not one of them. Without the source code for TextAreaHandler, it's not clear if it implements any type of listener interface.

"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TextAreaHandler