heightField.setPrecision(4);
heightField.setPrecision(2);
   public void actionPerformed(ActionEvent ae)   {      if (settingUp)      {         return;      }      Object source = ae.getSource();      String selected;      if (source == widthUnits)      {         selected = (String) widthUnits.getSelectedItem();         int units_from = lastWidthUnit;         int units_to = widthUnits.getSelectedIndex();         resolution = resolutionField.getValue();         int resolution_units = resolutionUnitsBox.getSelectedIndex();         double factor =            getConversionFactor(               units_from,               units_to,               resolution,               resolution_units);         width = widthField.getValue() * factor;         lastWidthUnit = units_to;         if (selected.equals("pixels"))         {            // If the field is in pixels, don't display any decimal points            widthField.setPrecision(0);         }         else         {            // Otherwise, give four points of precision            widthField.setPrecision(4);         }         widthField.setValue(width);      }      if (source == heightUnits)      {         selected = (String) heightUnits.getSelectedItem();         if (selected.equals("pixels"))         {            // If the field is in pixels, don't display any decimal points            heightField.setPrecision(0);         }         else         {            // Otherwise, give four points of precision            heightField.setPrecision(4);         }      }   }