File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TextAreaHandler" Watch "TextAreaHandler" New topic


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.
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.setFont(new Font("TimesRoman",Font.ITALIC,24));
t.setToolTipText("this is a TextBox");
t.setText("type here");

TextAreaHandler handler=new TextAreaHandler();
Jim Yingst

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:
subject: TextAreaHandler
It's not a secret anymore!