コード例 #1
0
 private void clienteboxActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_clienteboxActionPerformed
   int value = clientebox.getSelectedIndex();
   if (value >= 1) {
     Puntos.setText(Integer.toString(listaTarjetas.get(value - 1).getPuntos()));
     cambiarPuntos.setEnabled(true);
   } else {
     Puntos.setText("XXXX");
     cambiarPuntos.setEnabled(false);
   }
 } // GEN-LAST:event_clienteboxActionPerformed
コード例 #2
0
 public void cargarBoxCliente() {
   clientebox.removeAllItems();
   clientebox.addItem("NINGUNO");
   for (Tarjeta p : listaTarjetas) {
     clientebox.addItem(p.getCodigo());
   }
   Puntos.setText("XXXX");
   cambiarPuntos.setEnabled(false);
 }
コード例 #3
0
 private void cambiarPuntosActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cambiarPuntosActionPerformed
   if (Double.parseDouble(Puntos.getText()) > 0) {
     Double t = Double.parseDouble(total.getText()) - Double.parseDouble(Puntos.getText());
     if (t < 0.0) {
       t = 0.0;
     }
     total.setText(t.toString());
     Puntos.setText("0");
     listaTarjetas.get(clientebox.getSelectedIndex() - 1).CangearPuntos();
   }
 } // GEN-LAST:event_cambiarPuntosActionPerformed
コード例 #4
0
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    botonAgregarProducto = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    tablaVenta = new javax.swing.JTable();
    jLabel3 = new javax.swing.JLabel();
    finalizarVenta = new javax.swing.JButton();
    NumeroProductos = new javax.swing.JSpinner();
    productoBox = new javax.swing.JComboBox<>();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    precio = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    clientebox = new javax.swing.JComboBox<>();
    jLabel2 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    total = new javax.swing.JLabel();
    Cancelar = new javax.swing.JButton();
    Puntos = new javax.swing.JLabel();
    cambiarPuntos = new javax.swing.JButton();
    tipoDescuento = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(java.awt.Dialog.ModalityType.TOOLKIT_MODAL);
    setPreferredSize(new java.awt.Dimension(500, 491));
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(255, 255, 255));
    jLabel1.setText("DESCUENTO");
    getContentPane()
        .add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 40, -1, 30));

    botonAgregarProducto.setBackground(new java.awt.Color(102, 102, 102));
    botonAgregarProducto.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    botonAgregarProducto.setForeground(new java.awt.Color(255, 255, 255));
    botonAgregarProducto.setText("AGREGAR");
    botonAgregarProducto.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            botonAgregarProductoActionPerformed(evt);
          }
        });
    getContentPane()
        .add(
            botonAgregarProducto,
            new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 70, 100, 20));

    tablaVenta.setBackground(new java.awt.Color(0, 0, 0));
    tablaVenta.setForeground(new java.awt.Color(255, 255, 255));
    tablaVenta.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {},
            new String[] {"DESCRIPCION", "CANTIDAD", "PRECIO UNITARIO", "DESCUENTO $", "TOTAL"}) {
          boolean[] canEdit = new boolean[] {false, false, false, false, false};

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });
    tablaVenta.setPreferredSize(new java.awt.Dimension(300, 398));
    jScrollPane1.setViewportView(tablaVenta);

    getContentPane()
        .add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, 470, 280));

    jLabel3.setBackground(new java.awt.Color(51, 51, 51));
    jLabel3.setFont(new java.awt.Font("Arial", 0, 24)); // NOI18N
    jLabel3.setForeground(new java.awt.Color(255, 255, 255));
    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("NUEVA VENTA");
    getContentPane()
        .add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 500, 30));

    finalizarVenta.setBackground(new java.awt.Color(102, 102, 102));
    finalizarVenta.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    finalizarVenta.setForeground(new java.awt.Color(255, 255, 255));
    finalizarVenta.setText("GUARDAR VENTA");
    finalizarVenta.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            finalizarVentaActionPerformed(evt);
          }
        });
    getContentPane()
        .add(finalizarVenta, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 420, 230, -1));

    NumeroProductos.setModel(new javax.swing.SpinnerNumberModel(0, 0, 10, 1));
    getContentPane()
        .add(NumeroProductos, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 70, 70, 20));

    productoBox.setModel(
        new javax.swing.DefaultComboBoxModel<>(
            new String[] {"Item 1", "Item 2", "Item 3", "Item 4"}));
    productoBox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            productoBoxActionPerformed(evt);
          }
        });
    getContentPane()
        .add(productoBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 100, 20));

    jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
    jLabel4.setForeground(new java.awt.Color(255, 255, 255));
    jLabel4.setText("PRECIO");
    getContentPane()
        .add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 40, -1, 30));

    jLabel5.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
    jLabel5.setForeground(new java.awt.Color(255, 255, 255));
    jLabel5.setText("CANTIDAD");
    getContentPane()
        .add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 40, -1, 30));

    precio.setForeground(new java.awt.Color(0, 204, 51));
    precio.setText("c/u $");
    getContentPane()
        .add(precio, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 70, 70, 20));

    jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
    jLabel6.setForeground(new java.awt.Color(255, 255, 255));
    jLabel6.setText("PRODUCTO");
    getContentPane()
        .add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, 30));

    clientebox.setModel(
        new javax.swing.DefaultComboBoxModel<>(
            new String[] {"Item 1", "Item 2", "Item 3", "Item 4"}));
    clientebox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            clienteboxActionPerformed(evt);
          }
        });
    getContentPane()
        .add(clientebox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 390, 80, -1));

    jLabel2.setForeground(new java.awt.Color(255, 255, 255));
    jLabel2.setText("PTS:");
    getContentPane()
        .add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 390, 30, 20));

    jLabel7.setForeground(new java.awt.Color(0, 255, 0));
    jLabel7.setText("TOTAL $ ");
    getContentPane()
        .add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 390, -1, 20));

    total.setForeground(new java.awt.Color(0, 255, 0));
    getContentPane()
        .add(total, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 390, 110, 20));

    Cancelar.setBackground(new java.awt.Color(102, 102, 102));
    Cancelar.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    Cancelar.setForeground(new java.awt.Color(255, 255, 255));
    Cancelar.setText("CANCELAR VENTA");
    Cancelar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelarActionPerformed(evt);
          }
        });
    getContentPane()
        .add(Cancelar, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 420, 230, -1));

    Puntos.setForeground(new java.awt.Color(255, 255, 255));
    Puntos.setText("puntos");
    getContentPane()
        .add(Puntos, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 390, 40, 20));

    cambiarPuntos.setBackground(new java.awt.Color(51, 255, 51));
    cambiarPuntos.setText("CANGEAR");
    cambiarPuntos.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cambiarPuntosActionPerformed(evt);
          }
        });
    getContentPane()
        .add(cambiarPuntos, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 390, -1, 20));

    tipoDescuento.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
    tipoDescuento.setForeground(new java.awt.Color(204, 0, 0));
    tipoDescuento.setText("Tipo");
    getContentPane()
        .add(tipoDescuento, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 70, 80, 20));

    pack();
  } // </editor-fold>//GEN-END:initComponents