There are 3 errors:
import java.awt.*;
import javax.swing.*;
public class ChatClient implements ActionListener <--- Error "ActionListener cannot be resolved to type"
{
private TextArea output;
private TextField input;
private Button sendButton;
private Button quitButton;
public ChatClient()
{
output = new TextArea(10,50);
input = new TextField(50);
sendButton = new Button("Send");
quitButton = new Button("Quit");
}
public void launchFrame()
{
Frame f = new Frame("Chat Room");
f.setLayout(new BorderLayout());
f.add(output, BorderLayout.WEST);
f.add(input, BorderLayout.SOUTH);
Panel p = new Panel();
p.setLayout(new GridLayout(2,1));
p.add(sendButton);
p.add(quitButton);
f.add(p, BorderLayout.CENTER);
f.pack();
f.setVisible(true);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
} );
public void actionPerformed(ActionEvent ae) <--- error here
{
if (ae.getSource() == sendButton)
{
sendButton.setText("You Clicked me!"); <--- error here "The method setText(String) is undefined for type button
}
}
}
public static void main(String args[])
{
ChatClient cc = new ChatClient();
cc.launchFrame();
}
}{code}
I'm stumped and these books I have are apparently crap if they cannot teach me how to do events correctly. Anyways...
Help please!
Thanks!