Ejemplo n.º 1
0
 private void FormaActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_FormaActionPerformed
   // TODO add your handling code here:
   if ((Vias.getSelectedItem() != "Vias de administracion") && (Forma.getItemCount()) != 0) {
     if (Forma.getSelectedItem().equals("Forma")) {
       Tipo.removeAllItems();
       Tipo.addItem("Tipo");
     } else {
       Tipo.removeAllItems();
       Tipo.addItem("Tipo");
       for (String s : v) {
         Tipo.addItem(s);
       }
     }
   }
 } // GEN-LAST:event_FormaActionPerformed
Ejemplo n.º 2
0
  public String toString() {

    return "Funcion "
        + retorno.toString()
        + " "
        + nombre
        + "-"
        + params.toString()
        + vbles.toString()
        + cuerpo.toString();
  }
Ejemplo n.º 3
0
  public BicicletaPolicia(
      int ano, String corBase, int numRodas, String tipoBicicleta, String tipoPolicia, String ID) {
    super(ano, corBase, numRodas, tipoBicicleta);

    try {
      tipo = Tipo.valueOf(tipoPolicia);
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          "Tipo de Bicicleta Pol’cia inv‡lida!\nPermitidos: INEM, Bombeiros, GNR, PSP, PJ");
    }

    setID(ID);
  }
Ejemplo n.º 4
0
  private void AceptarActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_AceptarActionPerformed
    // TODO add your handling code here:
    if (!(Name.getText().equals("")
        && Cantidad.getText().equals("")
        && Precio.getText().equals("")
        && Marca.getText().equals("")
        && jTextArea1.getText().equals("")
        && Vias.getSelectedItem().equals("Vias de administracion")
        && Forma.getSelectedItem().equals("Forma")
        && Tipo.getSelectedItem().equals("Tipo"))) {
      if (b == false) {
        Producto p = new Producto();
        p.setName(Name.getText());
        p.setId(parseInt(jLabel2.getText()));
        p.setCantidad(parseInt(Cantidad.getText()));
        p.setPrecio(parseDouble(Precio.getText()));
        p.setDescripcion(jTextArea1.getText());
        p.setMarca(Marca.getText());
        p.setVia((String) Vias.getSelectedItem());
        p.setForma((String) Forma.getSelectedItem());
        p.setTipo((String) Tipo.getSelectedItem());
        Clear();
        new Conectar().ModificarProd(p);
        JOptionPane.showMessageDialog(null, "Su producto fue modificado exitosamente");
        dispose();
      } else {
        List<Producto> p1 = new Conectar().ConexionProd();
        for (Producto pd : p1) {
          String s, s1;
          s = new Search().SetLength("" + pd.getId());
          s1 = jLabel2.getText();
          if (s.equals(s1)) {
            double x = pd.getPrecio(), x1 = parseDouble(Precio.getText());
            double t = (x + x1) / 2;
            int y = pd.getCantidad(), y1 = parseInt(Cantidad.getText());
            int t1 = y + y1;
            Producto p = new Producto();
            p = pd;
            p.setPrecio(t);
            p.setCantidad(t1);
            Clear();
            new Conectar().ModificarProd(p);
            Calendar c = Calendar.getInstance();
            String Fecha = Integer.toString(c.get(Calendar.DATE));
            Fecha += "/";
            Fecha += Integer.toString(c.get(Calendar.MONTH) + 1);
            Fecha += "/";
            Fecha += Integer.toString(c.get(Calendar.YEAR));
            String name = null;
            try {
              name = new UseUser().GetUser();
            } catch (IOException e) {
            }
            name = name.trim();
            Producto p2 = new Producto();
            p2 = pd;
            p2.setCantidad(y1);
            p2.setPrecio(x1);
            new Conectar().InsertCompra(p2, Fecha, name);
            JOptionPane.showMessageDialog(null, "Su Compra fue realizada exitosamente");
            dispose();
          }
        }
      }
    } else if (!(Name.getText().equals("")
        && Cantidad.getText().equals("")
        && Precio.getText().equals("")
        && Marca.getText().equals("")
        && jTextArea1.getText().equals("")
        && Vias.getSelectedItem().equals("Vias de administracion")
        && Forma.getSelectedItem().equals("Forma")
        && Tipo.getSelectedItem().equals("Tipo")
        && b)) {

    } else {
      JOptionPane.showMessageDialog(
          null,
          "Debe de llenar todos los campos",
          "Informacion Incompleta",
          JOptionPane.INFORMATION_MESSAGE,
          null);
    }
  } // GEN-LAST:event_AceptarActionPerformed
Ejemplo n.º 5
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    Name = new javax.swing.JTextField(8);
    jLabel3 = new javax.swing.JLabel();
    Marca = new javax.swing.JTextField(8);
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    Cantidad = new javax.swing.JTextField(8);
    Precio = new javax.swing.JTextField(8);
    jLabel6 = new javax.swing.JLabel();
    Vias = new javax.swing.JComboBox();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    Forma = new javax.swing.JComboBox();
    Tipo = new javax.swing.JComboBox();
    jLabel9 = new javax.swing.JLabel();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();
    jPanel5 = new javax.swing.JPanel();
    Aceptar = new javax.swing.JButton();
    Limpiar = new javax.swing.JButton();
    Atras = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(false);

    jPanel1.setLayout(new java.awt.BorderLayout());

    java.awt.GridBagLayout jPanel2Layout = new java.awt.GridBagLayout();
    jPanel2Layout.columnWidths =
        new int[] {
          0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8,
          0
        };
    jPanel2Layout.rowHeights = new int[] {0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0};
    jPanel2.setLayout(jPanel2Layout);

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel1.setText("Id:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel1, gridBagConstraints);

    jLabel2.setText("jLabel2");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Name, gridBagConstraints);

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel3.setText("Nombre:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel3, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Marca, gridBagConstraints);

    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel4.setText("Marca:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel4, gridBagConstraints);

    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel5.setText("Cantidad:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel5, gridBagConstraints);

    Cantidad.addFocusListener(
        new java.awt.event.FocusAdapter() {
          public void focusLost(java.awt.event.FocusEvent evt) {
            CantidadFocusLost(evt);
          }
        });
    Cantidad.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyTyped(java.awt.event.KeyEvent evt) {
            CantidadKeyTyped(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Cantidad, gridBagConstraints);

    Precio.addFocusListener(
        new java.awt.event.FocusAdapter() {
          public void focusLost(java.awt.event.FocusEvent evt) {
            PrecioFocusLost(evt);
          }
        });
    Precio.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyTyped(java.awt.event.KeyEvent evt) {
            PrecioKeyTyped(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Precio, gridBagConstraints);

    jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel6.setText("Precio:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel6, gridBagConstraints);

    Vias.removeAllItems();
    String[] v = {
      "Oral",
      "Intramuscular",
      "Intravenosa",
      "Subcutánea",
      "Inhalatoria",
      "Transdermica",
      "Nasal",
      "Oftalmica",
      "Ótica",
      "Tópica",
      "Rectal",
      "Vaginal"
    };
    Vias.addItem("Vias de administracion");
    for (String s : v) {
      Vias.addItem(s);
    }
    Vias.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ViasActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Vias, gridBagConstraints);

    jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel7.setText("Via:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel7, gridBagConstraints);

    jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel8.setText("Forma:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel8, gridBagConstraints);

    Forma.removeAllItems();
    Forma.addItem("Forma");
    Forma.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            FormaActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Forma, gridBagConstraints);

    Tipo.removeAllItems();
    Tipo.addItem("Tipo");
    Tipo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            TipoActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 14;
    gridBagConstraints.gridy = 14;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(Tipo, gridBagConstraints);

    jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel9.setText("Tipo:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 12;
    gridBagConstraints.gridy = 14;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel2.add(jLabel9, gridBagConstraints);

    jPanel1.add(jPanel2, java.awt.BorderLayout.CENTER);
    jPanel1.add(jPanel3, java.awt.BorderLayout.PAGE_START);

    jPanel4.setLayout(new java.awt.BorderLayout());

    jTextArea1.setColumns(20);
    jTextArea1.setRows(5);
    jTextArea1.setBorder(javax.swing.BorderFactory.createTitledBorder("Descripción"));
    jScrollPane1.setViewportView(jTextArea1);

    jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);

    Aceptar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    Aceptar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            AceptarActionPerformed(evt);
          }
        });
    jPanel5.add(Aceptar);

    Limpiar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    Limpiar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            LimpiarActionPerformed(evt);
          }
        });
    jPanel5.add(Limpiar);

    Atras.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    Atras.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            AtrasActionPerformed(evt);
          }
        });
    jPanel5.add(Atras);

    jPanel4.add(jPanel5, java.awt.BorderLayout.PAGE_END);

    jPanel1.add(jPanel4, java.awt.BorderLayout.PAGE_END);

    getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

    setSize(new java.awt.Dimension(464, 468));
    setLocationRelativeTo(null);
  } // </editor-fold>//GEN-END:initComponents
Ejemplo n.º 6
0
 private void ViasActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_ViasActionPerformed
   // TODO add your handling code here:
   if (Vias.getSelectedItem().equals("Oral")) {
     String[] v = {
       "Cápsulas",
       "Comprimidos",
       "Grageas",
       "Preparados líquidos",
       "Jarabes",
       "Elixires",
       "Suspensiones"
     };
     Forma.removeAllItems();
     Forma.addItem("Forma");
     for (String s : v) {
       Forma.addItem(s);
     }
   } else if (Vias.getSelectedItem().equals("Intramuscular")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Inyección");
   } else if (Vias.getSelectedItem().equals("Intravenosa")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Inyección");
   } else if (Vias.getSelectedItem().equals("Vias de administracion")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Tópica")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Cremas");
     Forma.addItem("Spray");
     Forma.addItem("Unguento");
     Forma.addItem("Jabón");
     Forma.addItem("Shampoo");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Ótica")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Gotas");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Subcutánea")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Inyección");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Inhalatoria")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Spray");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Nasal")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Crema");
     Forma.addItem("Unguento");
     Forma.addItem("Spray");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Oftalmica")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Crema");
     Forma.addItem("Gotas");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Transdermica")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Inyección");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Rectal")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Supositorio");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   } else if (Vias.getSelectedItem().equals("Vaginal")) {
     Forma.removeAllItems();
     Forma.addItem("Forma");
     Forma.addItem("Crema");
     Forma.addItem("Ovulos");
     Tipo.removeAllItems();
     Tipo.addItem("Tipo");
   }
 } // GEN-LAST:event_ViasActionPerformed
Ejemplo n.º 7
0
 @Override
 public boolean equals(Object b) {
   return super.equals(b)
       && tipo.equals(((BicicletaPolicia) b).tipo)
       && ID.equals(((BicicletaPolicia) b).ID);
 }
Ejemplo n.º 8
0
 @Override
 public String getTipo() {
   return tipo.toString();
 }