public void setValue(Object o) {
   try {
     setText(sfmt.valueToString(o));
   } catch (java.text.ParseException e) {
     setText("x" + e.toString()); // Should not happen
   }
 }
Esempio n. 2
0
  /** See if edit value is valid, put error message in buff. */
  protected boolean _validate(StringBuffer buff) {
    String editValue = tf.getText().trim();
    if (editValue.length() == 0) return true; // empty ok

    try {
      new TimeDuration(tf.getText());
      return true;
    } catch (java.text.ParseException e) {
      buff.append(label).append(": ").append(e.getMessage());
      return false;
    }
  }