Registro de venta

1,590 views
1,498 views

Published on

java

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,590
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Registro de venta

  1. 1. package Prueba; importLista.ListaRegistro; import javax.swing.JOptionPane; public class frmregistroventa extends javax.swing.JFrame { public ListaRegistro lsr=new ListaRegistro(); String carg, esta; public frmregistroventa() { initComponents(); }
  2. 2. @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { buttonGroup2 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txtnom = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txtape = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtdni = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); txtsu = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); rbinge = new javax.swing.JRadioButton(); rbabo = new javax.swing.JRadioButton(); rbconta = new javax.swing.JRadioButton(); jPanel3 = new javax.swing.JPanel(); rbnom = new javax.swing.JRadioButton(); rbcontra = new javax.swing.JRadioButton(); jScrollPane1 = new javax.swing.JScrollPane(); txtdato = new javax.swing.JTextArea(); jLabel5 = new javax.swing.JLabel(); btnnuevo = new javax.swing.JButton();
  3. 3. btnagegar = new javax.swing.JButton(); btnmostrar = new javax.swing.JButton(); btnbuscar = new javax.swing.JButton(); btnmodificar = new javax.swing.JButton(); btneliminar = new javax.swing.JButton(); btnsalir = new javax.swing.JButton(); txtbuscar = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); txtdato1 = new javax.swing.JTextArea(); jLabel6 = new javax.swing.JLabel(); jScrollPane4 = new javax.swing.JScrollPane(); txtresubus = new javax.swing.JTextArea(); jLabel7 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setFocusable(false); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel1.setBackground(new java.awt.Color(0, 0, 0)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos del Trabajador", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(204, 204, 204))); // NOI18N jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel1.setForeground(new java.awt.Color(204, 204, 204));
  4. 4. jLabel1.setText("Nombres:"); jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 34, -1, -1)); txtnom.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.add(txtnom, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 31, 136, -1)); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel2.setForeground(new java.awt.Color(204, 204, 204)); jLabel2.setText("Apellidos:"); jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 72, -1, -1)); txtape.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.add(txtape, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 69, 161, -1)); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel3.setForeground(new java.awt.Color(204, 204, 204)); jLabel3.setText("DNI:"); jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 110, -1, -1)); txtdni.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.add(txtdni, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 107, 84, -1)); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel4.setForeground(new java.awt.Color(204, 204, 204)); jLabel4.setText("Sueldo"); jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, -1, -1));
  5. 5. txtsu.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.add(txtsu, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 140, 84, -1)); getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 11, 360, 179)); jPanel2.setBackground(new java.awt.Color(0, 0, 0)); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cargo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(204, 204, 204))); // NOI18N jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); rbinge.setBackground(new java.awt.Color(0, 0, 0)); buttonGroup2.add(rbinge); rbinge.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N rbinge.setForeground(new java.awt.Color(204, 204, 204)); rbinge.setText("Ingeniero"); rbinge.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); rbinge.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbingeActionPerformed(evt); } }); jPanel2.add(rbinge, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 28, -1, -1));
  6. 6. rbabo.setBackground(new java.awt.Color(0, 0, 0)); buttonGroup2.add(rbabo); rbabo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N rbabo.setForeground(new java.awt.Color(204, 204, 204)); rbabo.setText("Abogado"); rbabo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbaboActionPerformed(evt); } }); jPanel2.add(rbabo, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 54, -1, -1)); rbconta.setBackground(new java.awt.Color(0, 0, 0)); buttonGroup2.add(rbconta); rbconta.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N rbconta.setForeground(new java.awt.Color(204, 204, 204)); rbconta.setText("Contador"); rbconta.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbcontaActionPerformed(evt); } }); jPanel2.add(rbconta, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 80, -1, -1)); getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 203, 118, -1));
  7. 7. jPanel3.setBackground(new java.awt.Color(0, 0, 0)); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Estado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(204, 204, 204))); // NOI18N jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); rbnom.setBackground(new java.awt.Color(0, 0, 0)); rbnom.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N rbnom.setForeground(new java.awt.Color(204, 204, 204)); rbnom.setText("Nombrado"); rbnom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbnomActionPerformed(evt); } }); jPanel3.add(rbnom, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, -1, -1)); rbcontra.setBackground(new java.awt.Color(0, 0, 0)); rbcontra.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N rbcontra.setForeground(new java.awt.Color(204, 204, 204)); rbcontra.setText("Contratado"); rbcontra.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbcontraActionPerformed(evt); }
  8. 8. }); jPanel3.add(rbcontra, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, -1, -1)); getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 200, 130, 110)); txtdato.setBackground(new java.awt.Color(204, 204, 204)); txtdato.setColumns(20); txtdato.setFont(new java.awt.Font("Monospaced", 1, 13)); // NOI18N txtdato.setRows(5); jScrollPane1.setViewportView(txtdato); getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 340, 160, 110)); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel5.setText("INGRESAR DNI"); getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 470, 1, -1)); btnnuevo.setBackground(new java.awt.Color(0, 0, 0)); btnnuevo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btnnuevo.setForeground(new java.awt.Color(204, 204, 204)); btnnuevo.setText("NUEVO"); btnnuevo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnnuevoActionPerformed(evt);
  9. 9. } }); getContentPane().add(btnnuevo, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 200, 90, -1)); btnagegar.setBackground(new java.awt.Color(0, 0, 0)); btnagegar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btnagegar.setForeground(new java.awt.Color(204, 204, 204)); btnagegar.setText("AGREGAR"); btnagegar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnagegarActionPerformed(evt); } }); getContentPane().add(btnagegar, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 240, 90, -1)); btnmostrar.setBackground(new java.awt.Color(0, 0, 0)); btnmostrar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btnmostrar.setForeground(new java.awt.Color(204, 204, 204)); btnmostrar.setText("MOSTRAR"); btnmostrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnmostrarActionPerformed(evt); } });
  10. 10. getContentPane().add(btnmostrar, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 280, 90, -1)); btnbuscar.setBackground(new java.awt.Color(0, 0, 0)); btnbuscar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btnbuscar.setForeground(new java.awt.Color(204, 204, 204)); btnbuscar.setText("BUSCAR"); btnbuscar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnbuscarActionPerformed(evt); } }); getContentPane().add(btnbuscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 490, -1, -1)); btnmodificar.setBackground(new java.awt.Color(0, 0, 0)); btnmodificar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btnmodificar.setForeground(new java.awt.Color(204, 204, 204)); btnmodificar.setText("Modificar"); btnmodificar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnmodificarActionPerformed(evt); } }); getContentPane().add(btnmodificar, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 320, 90, -1));
  11. 11. btneliminar.setBackground(new java.awt.Color(0, 0, 0)); btneliminar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btneliminar.setForeground(new java.awt.Color(204, 204, 204)); btneliminar.setText("ELIMINAR"); getContentPane().add(btneliminar, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 360, 90, -1)); btnsalir.setBackground(new java.awt.Color(0, 0, 0)); btnsalir.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btnsalir.setForeground(new java.awt.Color(204, 204, 204)); btnsalir.setText("SALIR"); btnsalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnsalirActionPerformed(evt); } }); getContentPane().add(btnsalir, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 400, 90, -1)); txtbuscar.setBackground(new java.awt.Color(204, 204, 204)); txtbuscar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N txtbuscar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtbuscarActionPerformed(evt); } });
  12. 12. getContentPane().add(txtbuscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 490, 250, 22)); txtdato1.setBackground(new java.awt.Color(204, 204, 204)); txtdato1.setColumns(20); txtdato1.setFont(new java.awt.Font("Monospaced", 1, 13)); // NOI18N txtdato1.setRows(5); jScrollPane2.setViewportView(txtdato1); getContentPane().add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 340, 90, 110)); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel6.setText("Nombres"); getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 318, 1, -1)); txtresubus.setBackground(new java.awt.Color(204, 204, 204)); txtresubus.setColumns(20); txtresubus.setFont(new java.awt.Font("Monospaced", 1, 13)); // NOI18N txtresubus.setRows(5); jScrollPane4.setViewportView(txtresubus); getContentPane().add(jScrollPane4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 540, 250, -1)); jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  13. 13. jLabel7.setText("SUELDO NETO"); getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 320, 1, -1)); pack(); }// </editor-fold> private void rbingeActionPerformed(java.awt.event.ActionEvent evt) { carg="Ingeniero"; } private void rbaboActionPerformed(java.awt.event.ActionEvent evt) { carg="Abogado"; } private void rbcontaActionPerformed(java.awt.event.ActionEvent evt) { carg="Contador"; } private void rbnomActionPerformed(java.awt.event.ActionEvent evt) { esta="Nombrado"; } private void rbcontraActionPerformed(java.awt.event.ActionEvent evt) { esta="Contratado";
  14. 14. } private void btnbuscarActionPerformed(java.awt.event.ActionEvent evt) { String d; d=txtbuscar.getText(); txtresubus.append(lsr.buscar(d)); } private void btnmostrarActionPerformed(java.awt.event.ActionEvent evt) { txtdato.append(lsr.mostrarnombre()); txtdato1.append(lsr.mostrarsueldo()); } private void btnmodificarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void btnnuevoActionPerformed(java.awt.event.ActionEvent evt) { rbabo.setSelected(false); rbconta.setSelected(false); rbinge.setSelected(false); rbnom.setSelected(false); rbcontra.setSelected(false); txtnom.setText(""); txtape.setText("");
  15. 15. txtbuscar.setText(""); txtdato.setText(""); txtdato1.setText(""); txtdni.setText(""); txtresubus.setText(""); txtsu.setText(""); } private void txtbuscarActionPerformed(java.awt.event.ActionEvent evt) { txtresubus.setText(null); txtresubus.append(lsr.buscar(null)); } private void btnagegarActionPerformed(java.awt.event.ActionEvent evt) { String d, a, n, car, es; double su; d=txtdni.getText(); a=txtape.getText(); n=txtnom.getText(); su=Double.parseDouble(txtsu.getText()); car=carg; es=esta; lsr.agregar(d, n, a, car, su, es);
  16. 16. } private void btnsalirActionPerformed(java.awt.event.ActionEvent evt) { int x=JOptionPane.showConfirmDialog(rootPane, "Desea Salir", "Salir", JOptionPane.INFORMATION_MESSAGE); if(x==0) System.exit(0); }

×