Exemplo n.º 1
0
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmd.equals(F_TO_C)) {
     int f = fTextField.getValue();
     int c = GMath.round((5.0 / 9.0) * (f - 32));
     cTextField.setValue(c);
   } else if (cmd.equals(C_TO_F)) {
     int c = cTextField.getValue();
     int f = GMath.round((9.0 / 5.0) * c + 32);
     fTextField.setValue(f);
   }
 }