0% found this document useful (0 votes)
19 views1 page

Cliente

The document defines a Java class that creates a GUI client form with text fields and a button. When the button is clicked, it sends the text field data as an object over a socket to a server.

Uploaded by

franc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Cliente

The document defines a Java class that creates a GUI client form with text fields and a button. When the button is clicked, it sends the text field data as an object over a socket to a server.

Uploaded by

franc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package cliente.

com/

import javax.swing.jButton;
import javax.swing.Jframe;
import javax.swing.Jtexfield;

public class frm cliente extende JFrame{


public Frm

jttexField txtip,txtorden;
jButtom Btnenviarz;

public FrmCliente() {

txtip = new JtextField();


txt.setBounds(10,10,100,20);

txtorden = new JtextField();


txtorden.setBound(10,10,100,20);

btnenviar=new JButton("enviar")
bt.enviar.setBounds(10,10,100,20);
btnenviar.add ActionListener(this)

add(txtip);
add(txtorden);
add(btnenviar);

setLayout(null);
setSize(400,400);
setVisible(true);

public static void main(String[] args) {


new FrmCliente();

@OverRide
public void action Performed(ActionEvent e)
if(e.getSource() == btnenviar) {
try {
socket cli = new Socket ("127.0.0.1",9090):
oreden bean = new Orden ();
bean.setIp(txtip.getText());
bean.setOrden(txtorden.getText());
ObjectOutpuStream flujo=
new ObjecOutputStream(cli.getOutputStream());
flujo.writeObject (bean);
cli.close();

} eatch (exception ex) {


ex.printStackTrace();

You might also like