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.*;
- public class lap3 extends JFrame implements ActionListener{
- private JTextField t1, t2, t3, t4, t;
- private JLabel l1, l2, l3, l4, l;
- private JButton boton;
- private JTextArea area;
- private JScrollPane barra;
- public lap3 (){
- super("Example_Class");
- this.setSize(400, 600);
- 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();
- l = new JLabel("Cambiar Marca");
- l1 = new JLabel("Cambiar Modelo");
- l2 = new JLabel("Cambiar Tamaño Memoria");
- l3 = new JLabel("Cambiar Precio");
- l4 = new JLabel("Objetos Utilizados");
- area = new JTextArea();
- barra = new JScrollPane(area);
- boton = new JButton("Desplegar Lista");
- this.add(l);
- l.setBounds(10, 20, 100, 20);
- this.add(t);
- t.setBounds(10, 50, 200, 25);
- this.add(l1);
- l1.setBounds(10, 80, 100, 20);
- this.add(t1);
- t1.setBounds(10, 110, 200, 25);
- this.add(l2);
- l2.setBounds(10, 140, 150, 20);
- this.add(t2);
- t2.setBounds(10, 170, 200, 25);
- this.add(l3);
- l3.setBounds(10, 200, 100, 20);
- this.add(t3);
- t3.setBounds(10, 230, 200, 25);
- this.add(l4);
- l4.setBounds(155, 360, 150, 20);
- this.add(t4);
- t4.setBounds(185, 330, 40, 25);
- this.add(boton);
- boton.setBounds(130, 280, 150, 30);
- boton.addActionListener(this);
- this.add(barra);
- barra.setBounds(10, 390, 375, 150 );
- }
- private void centrarventana (){
- Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
- Dimension ventana = getSize();
- setLocation((pantalla.width - ventana.width) /2, (pantalla.height - ventana.height) /2);
- }
- public void actionPerformed(ActionEvent e) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement