ui/src/main/java/ucar/util/prefs/ui/Field.java
static private void showFormatInfo( JFormattedTextField tf) {
      JFormattedTextField.AbstractFormatter ff = tf.getFormatter();
      System.out.println("AbstractFormatter  " +  ff.getClass().getName());
      if (ff instanceof NumberFormatter) {
        NumberFormatter nf = (NumberFormatter) ff;
        Format f = nf.getFormat();
        System.out.println(" Format  = " + f.getClass().getName());
        if (f instanceof NumberFormat) {
          NumberFormat nfat = (NumberFormat) f;
          System.out.println(" getMinimumIntegerDigits=" +
                             nfat.getMinimumIntegerDigits());
          System.out.println(" getMaximumIntegerDigits=" +
                             nfat.getMaximumIntegerDigits());
          System.out.println(" getMinimumFractionDigits=" +
                             nfat.getMinimumFractionDigits());
          System.out.println(" getMaximumFractionDigits=" +
                             nfat.getMaximumFractionDigits());
        }
        if (f instanceof DecimalFormat) {
          DecimalFormat df = (DecimalFormat) f;
          System.out.println(" Pattern  = " + df.toPattern());
        }
      }
    }
static private void showFormatInfo( JFormattedTextField tf) {
      JFormattedTextField.AbstractFormatter ff = tf.getFormatter();
      System.out.println("AbstractFormatter  " +  ff.getClass().getName());
      if (ff instanceof NumberFormatter) {
        NumberFormatter nf = (NumberFormatter) ff;
        Format f = nf.getFormat();
        System.out.println(" Format  = " + f.getClass().getName());
        if (f instanceof NumberFormat) {
          NumberFormat nfat = (NumberFormat) f;
          System.out.println(" getMinimumIntegerDigits=" +
                             nfat.getMinimumIntegerDigits());
          System.out.println(" getMaximumIntegerDigits=" +
                             nfat.getMaximumIntegerDigits());
          System.out.println(" getMinimumFractionDigits=" +
                             nfat.getMinimumFractionDigits());
          System.out.println(" getMaximumFractionDigits=" +
                             nfat.getMaximumFractionDigits());
        }
        if (f instanceof DecimalFormat) {
          DecimalFormat df = (DecimalFormat) f;
          System.out.println(" Pattern  = " + df.toPattern());
        }
      }
    }
An integer input field with an associated CDM.UNITS label.

static public class IntUnits extends Int implements UnitsField {
private String units;
IntUnits(String name, String label, String units, int defValue, PersistenceManager storeData) {
super(name, label, defValue, storeData);
this.units = units;
}
public String getUnits() { return units; }
}



A boolean input box that is used to enable/disable another field.

static public class BooleanEnabler extends YesNo {
private JRadioButton enabler;
private Field enabledField;

BooleanEnabler(String fldName, boolean initValue, Field enField, PersistenceManager storeData) {
super( fldName, "", initValue, storeData);
this.enabledField = enField;

enabler = new JRadioButton();
enabler.setSelected( ((Boolean)valueObj).booleanValue());
editComp = (JComponent) enabler;

enabledField.setEnabled(initValue);
enabler.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
boolean isOn = (e.getStateChange() == ItemEvent.SELECTED);
enabledField.setEnabled(isOn);
}
});
}

protected void setValue(Object newValue) {
boolean bvalue = ((Boolean)newValue).booleanValue();
enabler.setSelected(bvalue);
enabledField.setEnabled(bvalue);
_setValue( newValue);
}

public boolean isSelected() { return enabler.isSelected(); }
public void setSelected(boolean v) { enabler.setSelected(v); }

Field getEnabledField() { return enabledField; }
}