Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import net.proteanit.sql.DbUtils;
- import java.awt.*;
- import java.awt.event.*;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- public class Clientes extends JFrame{
- private static final long serialVersionUID = 1L;
- private JButton btnMostrar;
- private JPanel PanelContenido;
- private JTextField txtCliente;
- private JLabel lblCliente;
- private JTextField textField;
- private JLabel lblApM;
- private JLabel lblApP;
- private JLabel lblNombre;
- private JLabel lblCorreo;
- private JLabel lblTel;
- private JLabel lblColonia;
- private JLabel lblCalle;
- private JLabel lblNumero;
- private JLabel lblCP;
- private JLabel lblEdo;
- private JLabel lblSucursal;
- private JLabel lblCredito;
- private JLabel lblClienteFor;
- private JTextField txtNombre;
- private JTextField txtApP;
- private JTextField txtApM;
- private JTextField txtCorreo;
- private JTextField txtTel;
- private JTextField txtColonia;
- private JTextField txtCalle;
- private JTextField txtNumero;
- private JTextField txtCP;
- private JTextField txtLimite;
- private JTextField txtNoCliente;
- private JComboBox cmbEdo;
- private JComboBox cmbSucursal;
- private JPanel panel_2;
- private JLabel lblClienteMod;
- private JTextField txtClienteMod;
- private JButton btnAceptarMod;
- private JPanel panel_3;
- private JLabel lblClienteEli;
- private JTextField txtClienteEli;
- private JButton btnAceptarEli;
- private JPanel panel_4;
- private JButton btnMostrar_2;
- private JButton btnMostrar_3;
- private JTable table;
- public Clientes (){
- getContentPane().setLayout(null);
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.setBounds(140, 88, 163, 74);
- getContentPane().add(scrollPane);
- table = new JTable();
- scrollPane.setViewportView(table);
- setTitle("Clientes");
- setSize(600, 600);
- setLocationRelativeTo(null);
- setResizable(false);
- setDefaultCloseOperation(HIDE_ON_CLOSE);
- getContentPane().setLayout(null);
- PanelContenido = new JPanel();
- PanelContenido.setLayout(null);
- PanelContenido.setBounds(0, 0, 600, 600);
- panel_2 = new JPanel();
- panel_2.setLayout(null);
- panel_2.setBounds(24, 48, 543, 450);
- panel_2.setVisible(false);
- panel_3 = new JPanel();
- panel_3.setLayout(null);
- panel_3.setBounds(24, 48, 543, 400);
- panel_3.setVisible(false);
- panel_4 = new JPanel();
- panel_4.setLayout(null);
- panel_4.setBounds(24, 48, 543, 400);
- panel_3.setVisible(false);
- ClassLoader cl;
- cl = this.getClass().getClassLoader();
- Icon imagen = new ImageIcon(cl.getResource("imagenes/RedPoint.jpg"));
- JLabel labelEtiqueta = new JLabel(imagen);
- labelEtiqueta.setBounds(0, 40, 100,100);
- ClassLoader cl1;
- cl1 = this.getClass().getClassLoader();
- Icon imagen1 = new ImageIcon(cl1.getResource("imagenes/final.jpg"));
- JLabel labelEtiq = new JLabel(imagen1);
- labelEtiq.setBounds(480, 40, 100,100);
- JPanel panel = new JPanel();
- panel.setBounds(24, 48, 543, 400);
- panel.setLayout(null);
- panel.setVisible(false);
- JPanel panel1 = new JPanel();
- panel1.setBounds(34, 48, 513, 390);
- panel1.setLayout(null);
- JButton btnNuevoCliente = new JButton("Nuevo Cliente");
- btnNuevoCliente.setBounds(391, 524, 161, 25);
- btnNuevoCliente.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- panel.setVisible(false);
- panel_2.setVisible(true);
- panel_3.setVisible(false);
- panel_4.setVisible(false);
- }
- });
- JButton btnEliminarCliente = new JButton("Eliminar Cliente");
- btnEliminarCliente.setBounds(30, 524, 150, 25);
- btnEliminarCliente.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- panel_4.setVisible(true);
- panel.setVisible(false);
- panel_2.setVisible(false);
- panel_3.setVisible(false);
- }
- });
- lblApP = new JLabel("Apellido Paterno:");
- lblApP.setBounds(20,15,120,25);
- panel_2.add(lblApP);
- lblApM = new JLabel("Apellido Materno:");
- lblApM.setBounds(20,55,120,25);
- lblNombre = new JLabel("Nombre:");
- lblNombre.setBounds(20,95,120,25);
- lblCorreo = new JLabel("Correo:");
- lblCorreo.setBounds(20,135,120,25);
- lblTel = new JLabel("Teléfono:");
- lblTel.setBounds(20,175,120,25);
- lblColonia = new JLabel("Colonia");
- lblColonia.setBounds(20,215,120,25);
- lblCalle = new JLabel("Calle");
- lblCalle.setBounds(20,255,120,25);
- lblNumero = new JLabel("Número");
- lblNumero.setBounds(20,295,120,25);
- lblCP = new JLabel("Código Postal");
- lblCP.setBounds(250,295,120,25);
- lblCredito = new JLabel("Límite de Crédito:");
- lblCredito.setBounds(20,335,120,25);
- lblClienteFor = new JLabel("Número de Cliente:");
- lblClienteFor.setBounds(250,335,120,25);
- lblEdo = new JLabel("Estado");
- lblEdo.setBounds(20,370,100,25);
- lblSucursal = new JLabel("Sucursal");
- lblSucursal.setBounds(300,370,100,25);
- txtApP = new JTextField();
- txtApP.setBounds(140,20,180,25);
- txtApM = new JTextField();
- txtApM.setBounds(140,60,180,25);
- txtNombre = new JTextField();
- txtNombre.setBounds(140,95,220,25);
- txtCorreo = new JTextField();
- txtCorreo.setBounds(140,135,250,25);
- txtTel = new JTextField();
- txtTel.setBounds(140,175,180,25);
- txtColonia = new JTextField();
- txtColonia.setBounds(140,215,250,25);
- txtCalle = new JTextField();
- txtCalle.setBounds(140,255,250,25);
- txtNumero = new JTextField();
- txtNumero.setBounds(140,295,80,25);
- txtCP = new JTextField();
- txtCP.setBounds(350,295,80,25);
- txtLimite =new JTextField();
- txtLimite.setBounds(140,335,80,25);
- txtNoCliente = new JTextField();
- txtNoCliente.setBounds(370,335,80,25);
- JButton btnGuardar = new JButton("Guardar");
- btnGuardar.setBounds(80, 410, 100, 25);
- panel_2.add(btnGuardar);
- JButton btnCancelar = new JButton("Cancelar");
- btnCancelar.setBounds(320,410, 100, 25);
- btnCancelar.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- new Clientes().setVisible(true);
- }
- });
- panel_2.add(btnCancelar);
- cmbEdo = new JComboBox();
- cmbEdo.setBounds(100,370,180,25);
- cmbSucursal = new JComboBox();
- cmbSucursal.setBounds(370,370,150,25);
- cmbSucursal.addItem("Veracruz");
- cmbSucursal.addItem("Guadalajara");
- cmbSucursal.addItem("Guerrero");
- cmbSucursal.addItem("Oaxaca");
- lblCliente=new JLabel("Cliente:");
- txtCliente= new JTextField();
- lblCliente.setBounds(108, 55, 53, 20);
- panel.add(lblCliente);
- panel.add(txtCliente);
- JButton btnAceptar = new JButton("Aceptar");
- btnAceptar.setBounds(100, 345, 89, 23);
- panel.add(btnAceptar);
- textField = new JTextField();
- textField.setBounds(171, 55, 234, 20);
- panel.add(textField);
- lblClienteMod = new JLabel("Cliente:");
- lblClienteMod.setBounds(108,55,53,20);
- txtClienteMod = new JTextField();
- txtClienteMod.setBounds(171,55,234,20);
- btnAceptarMod = new JButton("Aceptar");
- btnAceptarMod.setBounds(219,345,89,23);
- lblClienteEli = new JLabel("Cliente:");
- lblClienteEli.setBounds(108,55,53,20);
- txtClienteEli = new JTextField();
- txtClienteEli.setBounds(171,55,234,20);
- btnAceptarEli = new JButton("Aceptar");
- btnAceptarEli.setBounds(219,345,89,23);
- JButton btnEstadoDeCuenta = new JButton("Estado de Cuenta");
- btnEstadoDeCuenta.setBounds(10, 11, 133, 23);
- btnEstadoDeCuenta.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- panel.setVisible(true);
- panel_2.setVisible(false);
- panel_3.setVisible(false);
- panel_4.setVisible(false);
- }
- });
- PanelContenido.add(btnEstadoDeCuenta);
- JButton btnModificarCliente = new JButton("Modificar Cliente");
- btnModificarCliente.setBounds(388, 11, 135, 23);
- btnModificarCliente.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- panel_3.setVisible(true);
- panel_2.setVisible(false);
- panel.setVisible(false);
- panel_4.setVisible(false);
- }
- });
- btnMostrar = new JButton("Mostrar Datos");
- btnMostrar.setBounds(300,345,150,25);
- btnMostrar.addActionListener(new ActionListener(){
- public void static showTables(){
- try{
- PreparedStatement ps = (PreparedStatement) BD_Connect.Conection().prepareStatement
- ("select id_cliente as ID, nombre_Cliente as Cliente from Cliente");
- ResultSet rs = ps.executeQuery();
- table.setModel(DbUtils.resultSetToTableModel(rs));
- ps.close();
- rs.close();
- }
- catch(Exception e){
- JOptionPane.showMessageDialog(null, "Exit");
- }
- }
- });
- btnMostrar_2 = new JButton("Mostrar Datos");
- btnMostrar_2.setBounds(300,345,150,25);
- btnMostrar_3 = new JButton("Mostrar Datos");
- btnMostrar_3.setBounds(300,345,150,25);
- panel.add(btnMostrar);
- panel_3.add(btnMostrar_2);
- panel_4.add(btnMostrar_3);
- panel_2.add(btnGuardar);
- panel_2.add(btnCancelar);
- panel_2.add(lblApP);
- panel_2.add(lblApM);
- panel_2.add(lblNombre);
- panel_2.add(lblCorreo);
- panel_2.add(lblTel);
- panel_2.add(lblColonia);
- panel_2.add(lblCalle);
- panel_2.add(lblNumero);
- panel_2.add(lblCP);
- panel_2.add(lblCredito);
- panel_2.add(lblClienteFor);
- panel_2.add(lblEdo);
- panel_2.add(lblSucursal);
- panel_2.add(txtApP);
- panel_2.add(txtApM);
- panel_2.add(txtCliente);
- panel_2.add(txtCorreo);
- panel_2.add(txtNombre);
- panel_2.add(txtTel);
- panel_2.add(txtColonia);
- panel_2.add(txtCalle);
- panel_2.add(txtCP);
- panel_2.add(txtNumero);
- panel_2.add(txtNoCliente);
- panel_2.add(txtLimite);
- panel_2.add(cmbEdo);
- panel_2.add(cmbSucursal);
- panel_3.add(lblClienteMod);
- panel_3.add(txtClienteMod);
- panel_3.add(btnAceptarMod);
- panel_4.add(lblClienteEli);
- panel_4.add(txtClienteEli);
- panel_4.add(btnAceptarEli);
- PanelContenido.add(btnModificarCliente);
- PanelContenido.add(btnEliminarCliente);
- PanelContenido.add(btnNuevoCliente);
- PanelContenido.add(panel);
- PanelContenido.add(panel_2);
- PanelContenido.add(panel_3);
- PanelContenido.add(panel_4);
- PanelContenido.add(labelEtiq);
- PanelContenido.add(labelEtiqueta);
- PanelContenido.setBackground(Color.red);
- panel.setBackground(Color.orange);
- panel_2.setBackground(Color.green);
- panel_3.setBackground(Color.gray);
- panel_4.setBackground(Color.blue);
- getContentPane().add(PanelContenido);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement