ejercicio 3

mail@pastecode.io avatar
unknown
java
2 months ago
2.6 kB
7
Indexable
Never
package Ejercicios;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.DefaultComboBoxModel;

public class Ejercicio3 extends JFrame implements ActionListener{

	private JPanel contentPane;
	private JTextField txtCantidad;
	private JButton btnProcesar;
	private JTextArea textArea;
	private JButton btnBorrar;
	private JComboBox cboProducto;
	
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Ejercicio3 frame = new Ejercicio3();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Ejercicio3() {
		setTitle("Tienda");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblNewLabel = new JLabel("Producto:");
		lblNewLabel.setBounds(27, 26, 66, 14);
		contentPane.add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("Cantidad:");
		lblNewLabel_1.setBounds(27, 64, 66, 14);
		contentPane.add(lblNewLabel_1);
		
		cboProducto = new JComboBox();
		cboProducto.setModel(new DefaultComboBoxModel(new String[] {"P0", "P1", "P2"}));
		cboProducto.setBounds(103, 22, 86, 22);
		contentPane.add(cboProducto);
		
		txtCantidad = new JTextField();
		txtCantidad.setBounds(103, 61, 86, 20);
		contentPane.add(txtCantidad);
		txtCantidad.setColumns(10);
		
		btnProcesar = new JButton("Procesar");
		btnProcesar.setBounds(298, 22, 89, 23);
		btnProcesar.addActionListener(this);
		contentPane.add(btnProcesar);
		
		btnBorrar = new JButton("Borrar");
		btnBorrar.setBounds(298, 60, 89, 23);
		btnProcesar.addActionListener(this);
		contentPane.add(btnBorrar);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 106, 414, 144);
		contentPane.add(scrollPane);
		
		textArea = new JTextArea();
		scrollPane.setViewportView(textArea);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}
}
Leave a Comment