NUEVO EJEMPLO
import javax.swing.*;
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
public class GRIDLAYOUT_2 extends Applet implements ActionListener
{
TextField t1,t2,t3;
Button b1;
Label l1;
public void init()
{
setLayout(new GridLayout(5,1));
t1=new TextField(20);
add(t1);
t2=new TextField(20);
add(t2);
l1=new Label("SE MOSTRARAN LOS DATOS ",Label.CENTER);
add(l1);
b1=new Button("MOSTRAR");
add(b1);
b1.addActionListener(this);
t3=new TextField(20);
add(t3);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
t3.setText(t1.getText()+" "+t2.getText());
}
}
}//CLASE PRINCIPAL
Suscribirse a:
Enviar comentarios (Atom)
0 comentarios:
Publicar un comentario