Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Dimension;
- import java.awt.Toolkit;
- 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.JScrollPane;
- import javax.swing.JTextArea;
- import javax.swing.JTextField;
- public class lap2 extends JFrame implements ActionListener{
- private JTextField t, t1, t2, t3, t4, t5;
- private JLabel l, l1, l2, l3, l4, l5;
- private JButton boton;
- private static int cont;
- private static int cont2 = 0;
- private laptop array[] = new laptop[cont];
- public lap2 (){
- super("Example_Class");
- this.setSize(400, 400);
- centrarventana();
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.setResizable(false);
- this.setLayout(null);
- creargui();
- }
- private void creargui (){
- t = new JTextField();
- t1 = new JTextField();
- t2 = new JTextField();
- t3 = new JTextField();
- t4 = new JTextField();
- t5 = new JTextField();
- l = new JLabel("Objetos Creados");
- l1 = new JLabel("Numero Objetos Laptop");
- l2 = new JLabel("Marca");
- l3 = new JLabel("Modelo");
- l4 = new JLabel("Tamaño Memoria");
- l5 = new JLabel("Precio");
- boton = new JButton("Listo");
- this.add(l);
- l.setBounds(230, 100, 150, 20 );
- this.add(t);
- t.setBounds(260, 130, 40, 25);
- this.add(l1);
- l1.setBounds(10, 20, 150, 20);
- this.add(t1);
- t1.setBounds(10, 50, 70, 25);
- this.add(l2);
- l2.setBounds(10, 80, 100, 20);
- this.add(t2);
- t2.setBounds(10, 110, 150, 25);
- this.add(l3);
- l3.setBounds(10, 140, 100, 20);
- this.add(t3);
- t3.setBounds(10, 170, 150, 25);
- this.add(l4);
- l4.setBounds(10, 200, 100, 20);
- this.add(t4);
- t4.setBounds(10, 230, 150, 25);
- this.add(l5);
- l5.setBounds(10, 260, 100, 20);
- this.add(t5);
- t5.setBounds(10, 290, 150, 25);
- this.add(boton);
- boton.setBounds(205, 220, 150, 30);
- boton.addActionListener(this);
- }
- private void contenedor (){
- cont = Integer.parseInt(t1.getText());
- for (int i = 0; i < cont; i++){
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement