Beispiel #1
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    if (jTextField1.getText() != null || jTextField1.getText().equals("0")) {
      int nbTicket = 0;

      try {
        nbTicket = Integer.parseInt(jTextField1.getText());

        int id = -1;
        int index = jXTable3.getSelectedRow();
        String name = (String) jXTable3.getModel().getValueAt(index, 0);
        Date date = listProjection.get(index).getDate();
        int salle = (int) jXTable3.getModel().getValueAt(index, 2);

        for (Projection proj : listProjection) {
          if (proj.getName() == name && proj.getSalle() == salle && proj.getDate() == date)
            id = proj.getId();
        }

        Commande commande = new Commande(date, id, nbTicket, salle);

        EnvoieCommande(commande);

      } catch (Exception ex) {
        JOptionPane.showMessageDialog(
            this,
            "Le contenu du champ 'Ticket' n'est pas dans un format numérique",
            "Text mal formée",
            JOptionPane.ERROR_MESSAGE);

        jTextField1.setText("");
      }
    }
  } // GEN-LAST:event_jButton1ActionPerformed
Beispiel #2
0
  private void initTab() {

    DefaultTableModel model = (DefaultTableModel) jXTable3.getModel();

    model.getDataVector().removeAllElements();
    jXTable3.repaint();

    for (Projection proj : listProjection) {

      Object[] list = new Object[4];

      list[0] = proj.getName();

      String heure = "";
      heure = new SimpleDateFormat("hh:mm", Locale.FRANCE).format(proj.getDate());

      list[1] = heure;
      list[2] = proj.getSalle();
      list[3] = proj.getPlace();

      model.addRow(list);
    }
  }