import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Ventana3 extends JFrame {
private JTextArea jTextArea1 = new JTextArea();
private JTextField jTextField1 = new JTextField();
private JButton jButton1 = new JButton();
private JScrollPane jScrollPane1 = new JScrollPane();
private JMenuBar jMenuBar1 = new JMenuBar();
private JMenu jMenu1 = new JMenu();
private JMenuItem jMenuItem1 = new JMenuItem();
private JMenuItem jMenuItem2 = new JMenuItem();
private JMenuItem jMenuItem3 = new JMenuItem();
public Ventana3() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout( null );
this.setSize(new Dimension(630, 558));
this.setJMenuBar(jMenuBar1);
jTextArea1.setEditable(false);
jTextField1.setBounds(new Rectangle(25, 450, 485, 30));
jButton1.setText("Agregar");
jButton1.setBounds(new Rectangle(520, 450, 90, 30));
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jScrollPane1.setBounds(new Rectangle(25, 15, 585, 405));
jMenu1.setText("Archivo");
jMenuItem1.setText("Abrir");
jMenuItem2.setText("Guardar");
jMenuItem3.setText("Salir");
jScrollPane1.getViewport().add(jTextArea1, null);
this.getContentPane().add(jScrollPane1, null);
this.getContentPane().add(jButton1, null);
this.getContentPane().add(jTextField1, null);
jMenu1.add(jMenuItem1);
jMenu1.add(jMenuItem2);
jMenu1.add(jMenuItem3);
jMenuBar1.add(jMenu1);
}
public static void main(String[] args) {
Ventana3 v = new Ventana3();
v.show();
}
private void jButton1_actionPerformed(ActionEvent e) {
jTextArea1.setText( jTextArea1.getText() + "\n" + jTextField1.getText() );
}
}