right, got the symbol errors sorted but im back to being stuck with the actionperform() and addactionlistener.
here's my update code
-
-
/*
-
* Main.java
-
*
-
* Created on 28 October 2008, 13:19
-
*
-
* To change this template, choose Tools | Options and locate the template under
-
* the Source Creation and Management node. Right-click the template and choose
-
* Open. You can then make changes to the template in the Source Editor.
-
*/
-
-
package clientside;
-
-
import java.io.*;
-
import java.net.*;
-
import java.util.*;
-
import javax.swing.*;
-
import java.awt.*;
-
-
public class Main implements ActionListener
-
{
-
public JFrame aFrame;
-
public JButton aButton;
-
public JButton aButton2;
-
public JTextField inputArea;
-
static Socket socket;
-
static PrintStream outStream;
-
-
public Main()
-
{
-
aFrame = new JFrame();
-
aFrame.setSize(500, 500);
-
aFrame.setTitle("Input your message");
-
aFrame.setLayout(new FlowLayout());
-
aFrame.setVisible(true);
-
-
aButton = new JButton();
-
aButton.setText("Press to send message");
-
aButton.setSize(200, 25);
-
aButton.addActionListener(this);
-
aFrame.add(aButton);
-
-
aButton2 = new JButton();
-
aButton2.setText("Press to clear message");
-
aButton2.setSize(200, 25);
-
aFrame.add(aButton2);
-
aButton2.setVisible(true);
-
-
inputArea = new JTextField(50);
-
inputArea.setVisible(true);
-
aFrame.add(inputArea);
-
}
-
public static void main(String[] args)
-
{
-
try
-
{
-
socket = new Socket("192.168.0.6", 4243);
-
outStream = new PrintStream(socket.getOutputStream());
-
}
-
catch (Exception anException)
-
{
-
System.out.println("Error: " + anException);
-
}
-
}
-
public void actionPerformed(ActionEvent e)
-
{
-
String aString = inputArea.getText();
-
if(aString.equals("exit"))
-
{
-
socket.close();
-
System.exit(1);
-
}
-
else
-
{
-
outStream.println(aString);
-
aString = inputArea.getText();
-
}
-
}
-
-
}
-
-
-
here's the errors :
init:
deps-jar:
Compiling 1 source file to C:\ClientSide\build\classes
C:\ClientSide\src\clientside\Main.java:19: cannot find symbol
symbol: class ActionListener
public class Main implements ActionListener
C:\ClientSide\src\clientside\Main.java:64: cannot find symbol
symbol : class ActionEvent
location: class clientside.Main
public void actionPerformed(ActionEvent e)
C:\ClientSide\src\clientside\Main.java:39: addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton cannot be applied to (clientside.Main)
aButton.addActionListener(this);
3 errors