Ejemplo n.º 1
0
 /**
  * Diff�rentes actions men�es suivant le choix de l'utilisateur
  *
  * @param e evenement d�clench� par le clic sur ok ou annuler
  */
 public void actionPerformed(ActionEvent e) {
   Object source = e.getSource();
   if (source == ok) {
     if (plus.getState() == true) {
       sign = 1;
     } else {
       sign = 0;
     }
     threshold = tf.getText();
     try {
       thresholdVal = Integer.parseInt(threshold);
       if (thresholdVal < 0) {
         JOptionPane.showMessageDialog(
             this.mf,
             "Threshold must be a positive integer",
             "Error",
             JOptionPane.WARNING_MESSAGE);
         this.setVisible(true);
       } else {
         gz.draw();
         gz.creatTrans(thresholdVal, sign);
         auto.modif(true);
         this.dispose();
       }
     } catch (NumberFormatException ex) {
       JOptionPane.showMessageDialog(
           this.mf, "Threshold must be a positive integer.", "Error", JOptionPane.WARNING_MESSAGE);
       this.setVisible(true);
     }
   } else if (source == cancel) {
     gz.draw();
     bar.displayInfo(mf.frameName);
     bar.can = true;
     this.dispose();
   }
   gz.menu.majMenus();
 }