sou novo no forum ! 
entao, to tentando fazer um esquema doido aqui mais nao funfa de jeito nenhum… java é confuso, ou eu sou confuso, sei la =[[ helpa ai ?
CODE
import java.awt.<em>;
import java.awt.event.</em>;
import javax.swing.*;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
class criaFrame01 {
public static void main(String[] args)
{
Frame f = new Frame();
f.setVisible(true);
}
}
class Frame01 extends JFrame implements ActionListener{
JTextField texto = new JTextField(32);
JButton submit = new JButton(“Enviar”);
Component textarea = new TextArea();
String text;
public Frame01() // Construtor
{
this.setTitle("Socket Teste");
this.setSize(470, 250);
this.setResizable(false);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
getContentPane().setLayout(new FlowLayout());
getContentPane().add(textarea);
getContentPane().add(texto);
submit.addActionListener(this); getContentPane().add(submit);
}
}
class connCliente extends Frame01{
public static void main(ActionEvent e){
if(e.getSource() == “submit”){
ConnCliente con = new ConnCliente();
t.cliente(texto.getText());
}
}
public char cliente(String args[]) {
Socket sock = null;
PrintStream stream = null;
try{
sock = new Socket("127.0.0.1",7000);
stream = new PrintStream(sock.getOutputStream());
stream.println(text);
}catch(IOException e){
System.out.println("Error 401: Não foi possivel conectar ao servidor.");
}finally{
try{
sock.close();
}catch(IOException e){}
}
}
}
ta, pode estar estranho, mais é o melhor jeito que eu to achando para fazer tongue.gif
QUOTE(erros)
--------------------Configuration: --------------------
C:\Documents and Settings\Luiz Fernando\Meus documentos\Java\aprendendoSockets\frameCliente.java:16: Frame01 is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
class Frame01 extends JFrame implements ActionListener{
^
C:\Documents and Settings\Luiz Fernando\Meus documentos\Java\aprendendoSockets\frameCliente.java:48: cannot resolve symbol
symbol : class ConnCliente
location: class connCliente
ConnCliente con = new ConnCliente();
^
C:\Documents and Settings\Luiz Fernando\Meus documentos\Java\aprendendoSockets\frameCliente.java:48: cannot resolve symbol
symbol : class ConnCliente
location: class connCliente
ConnCliente con = new ConnCliente();
^
C:\Documents and Settings\Luiz Fernando\Meus documentos\Java\aprendendoSockets\frameCliente.java:49: non-static variable texto cannot be referenced from a static context
t.cliente(texto.getText());
^
C:\Documents and Settings\Luiz Fernando\Meus documentos\Java\aprendendoSockets\frameCliente.java:49: cannot resolve symbol
symbol : variable t
location: class connCliente
t.cliente(texto.getText());
^
5 errors
Process completed.
abracos
