Пример #1
0
 public void initText() {
   this.setTitle(Bundle.getText("JDialogAlerteTitle"));
   labelDestinataire.setText(Bundle.getText("JDialogAlerteTo"));
   labelObjet.setText(Bundle.getText("JDialogAlerteObject"));
   buttonOK.setText(Bundle.getText("JDialogAlerteSend"));
   buttonCancel.setText(Bundle.getText("JDialogAlerteCancel"));
 }
Пример #2
0
  private void buttonOKActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_buttonOKActionPerformed

    // verification si les champs sont vides
    if (textIndDestinataire.getText().equals("")
        || textIndObjet.getText().equals("")
        || textMessage.getText().equals("")) {
      JOptionPane.showMessageDialog(
          this,
          Bundle.getText("JDialogAlerteChampsVides"),
          Bundle.getText("JDialogAlerteAttentionMessage"),
          JOptionPane.WARNING_MESSAGE);
      return;
    }

    try {
      // Envoie du login et du password a la servlet "CreerSuperviseurServlet" pour l'ajouter a la
      // BD
      URL url =
          new URL(
              "http://"
                  + P2S.P2S.Preferences.getProperty("host")
                  + ":"
                  + P2S.P2S.Preferences.getProperty("port")
                  + "/p2sserver/CreerUnMessageServlet?login="******"&sujet="
                  + this.textIndObjet.getText()
                  + "&message="
                  + this.textMessage.getText());

      // Buffer qui va recuperer la reponse de la servlet
      BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
      // On recupere la reponse
      String inputLine = in.readLine();
      if (inputLine.equalsIgnoreCase("ok")) { // on a enregistré dans la bd
        this.dispose();
        in.close();
        return;
      } else if (inputLine.equalsIgnoreCase("nok")) {
        JOptionPane.showMessageDialog(
            this,
            Bundle.getText("JDialogAlerteNoSup"),
            Bundle.getText("JDialogAlerteAttentionMessage"),
            JOptionPane.WARNING_MESSAGE);
      }
      in.close();
    } catch (MalformedURLException e1) {
      javax.swing.JOptionPane.showMessageDialog(
          null,
          Bundle.getText("ExceptionErrorURL"),
          Bundle.getText("ExceptionErrorTitle"),
          javax.swing.JOptionPane.ERROR_MESSAGE);
    } catch (IOException e2) {
      javax.swing.JOptionPane.showMessageDialog(
          null,
          Bundle.getText("ExceptionErrorIO"),
          Bundle.getText("ExceptionErrorTitle"),
          javax.swing.JOptionPane.ERROR_MESSAGE);
    } catch (IllegalArgumentException e3) {
      javax.swing.JOptionPane.showMessageDialog(
          null,
          Bundle.getText("ExceptionErrorARGS"),
          Bundle.getText("ExceptionErrorTitle"),
          javax.swing.JOptionPane.ERROR_MESSAGE);
    }
  } // GEN-LAST:event_buttonOKActionPerformed