Example #1
0
  private void initComboBox() {
    PacketCom packet = new PacketCom(VSMEAP.DOWNPROD, "DOWNPROD_OUI");
    sock.send(packet);
    try {
      PacketCom packetReponse = sock.receive();
      String type = packetReponse.getType();
      Object contenu = packetReponse.getObjet();
      Object[] infos = (Object[]) contenu;
      LinkedList<String> listeProduitsEntree = (LinkedList<String>) infos[0];
      LinkedList<String> listeProduitsPlat = (LinkedList<String>) infos[1];
      LinkedList<String> listeProduitsDessert = (LinkedList<String>) infos[2];

      for (String produitEntree : listeProduitsEntree) {
        SwingUtils.addToComboBox(GingrédientsEntree, produitEntree);
      }
      for (String produitPlat : listeProduitsPlat) {
        SwingUtils.addToComboBox(GingrédientsPlat, produitPlat);
      }
      for (String produitDessert : listeProduitsDessert) {
        SwingUtils.addToComboBox(GingrédientsDessert, produitDessert);
      }
    } catch (Exception ex) {
      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Example #2
0
 private void BvaliderMenuActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_BvaliderMenuActionPerformed
   String nomMenu = GnomMenu.getText();
   String nomVedette = Gvedette.getText();
   menu.setNomMenu(nomMenu);
   menu.setVedetteJour(nomVedette);
   try {
     byte[] xml = MyDom.serialize(menu);
     JOptionPane.showMessageDialog(this, "Création du fichier xml réussi !");
     Object[] infos = {(Object) xml, (Object) nomMenu};
     PacketCom packet = new PacketCom("UPMENU", (Object) infos);
     sock.send(packet);
     PacketCom packetReponse = sock.receive();
     String type = packetReponse.getType();
     if (type.equals(VSMEAP.UPMENU_OUI)) {
       JOptionPane.showMessageDialog(this, "Menu bien reçu par le serveur");
     }
   } catch (Exception ex) {
     Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
   }
 } // GEN-LAST:event_BvaliderMenuActionPerformed