You are on page 1of 1

import javax.swing.

*;
import java .awt.*;

public class Insertar extends JFrame implement ActionListener{

private JTextField lt1;


private JSrollPane scroll;
private JTextArea ct1;
private JButton boton1, boton2;

String text = "";

public Insertar(){
setLayout(null);
lt1 = new JTextField();
lt1.setBounds(10,10,200,30);
add(lt1);

boton1 = new JButton("Agregar");


boton1.setBounds(250,10,100,30);
add(boton1);
boton.addActionListener(this);

ct1 = new JTextArea();


scroll = new JScrollPane(ct1);
scroll.setBounds(10,50,400,300);
add(scroll);
}

public voidactionPerformed(AtionEvent x){


if(x.getSource() == boton1){
texto += lt1.getText() + "\n";
ct1.setText(Texto);
lt1.setText("");

}
}
public static void main(String args[]);
Insertar caja = new Insertar();
caja.setBounds(0,0,540,400);
caja.setVisible(true)
caja.setResizable(false);
caja.setLocationRelativeTo(null);
}

You might also like