Advertisement
Guest User

ReNcOoR

a guest
Nov 30th, 2010
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.20 KB | None | 0 0
  1. import java.awt.Dimension;
  2. import java.awt.Toolkit;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5.  
  6. import javax.swing.*;
  7.  
  8.  
  9.  
  10. public class lap3 extends JFrame implements ActionListener{
  11.    
  12.         private JTextField t1, t2, t3, t4, t;
  13.         private JLabel l1, l2, l3, l4, l;
  14.         private JButton boton;
  15.         private JTextArea area;
  16.         private JScrollPane barra;
  17.        
  18.        
  19.        
  20.         public lap3 (){
  21.            
  22.             super("Example_Class");
  23.             this.setSize(400, 600);
  24.             centrarventana();
  25.             this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  26.             this.setResizable(false);
  27.             this.setLayout(null);
  28.            
  29.             creargui();
  30.            
  31.            
  32.            
  33.            
  34.            
  35.            
  36.         }
  37.        
  38.         private void creargui (){
  39.            
  40.             t  = new JTextField();
  41.             t1 = new JTextField();
  42.             t2 = new JTextField();
  43.             t3 = new JTextField();
  44.             t4 = new JTextField();
  45.        
  46.             l  = new JLabel("Cambiar Marca");
  47.             l1 = new JLabel("Cambiar Modelo");
  48.             l2 = new JLabel("Cambiar Tamaño Memoria");
  49.             l3 = new JLabel("Cambiar Precio");
  50.             l4 = new JLabel("Objetos Utilizados");
  51.            
  52.             area = new JTextArea();
  53.             barra = new JScrollPane(area);
  54.             boton = new JButton("Desplegar Lista");
  55.            
  56.             this.add(l);
  57.             l.setBounds(10, 20, 100, 20);
  58.             this.add(t);
  59.             t.setBounds(10, 50, 200, 25);
  60.             this.add(l1);
  61.             l1.setBounds(10, 80, 100, 20);
  62.             this.add(t1);
  63.             t1.setBounds(10, 110, 200, 25);
  64.             this.add(l2);
  65.             l2.setBounds(10, 140, 150, 20);
  66.             this.add(t2);
  67.             t2.setBounds(10, 170, 200, 25);
  68.             this.add(l3);
  69.             l3.setBounds(10, 200, 100, 20);
  70.             this.add(t3);
  71.             t3.setBounds(10, 230, 200, 25);
  72.             this.add(l4);
  73.             l4.setBounds(155, 360, 150, 20);
  74.             this.add(t4);
  75.             t4.setBounds(185, 330, 40, 25);
  76.            
  77.             this.add(boton);
  78.             boton.setBounds(130, 280, 150, 30);
  79.             boton.addActionListener(this);
  80.            
  81.             this.add(barra);
  82.             barra.setBounds(10, 390, 375, 150 );
  83.            
  84.            
  85.            
  86.            
  87.            
  88.            
  89.         }
  90.        
  91.         private void centrarventana (){
  92.            
  93.             Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
  94.            
  95.             Dimension ventana = getSize();
  96.            
  97.             setLocation((pantalla.width - ventana.width) /2, (pantalla.height - ventana.height) /2);
  98.         }
  99.        
  100.            
  101.        
  102.         public void actionPerformed(ActionEvent e) {
  103.            
  104.            
  105.         }
  106.  
  107.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement