Class DecimalField

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants

public class DecimalField extends JTextField
This is a JTextField that accepts only decimal numbers.
Version:
1.0
Author:
Douglas Brown
See Also:
  • Constructor Details

    • DecimalField

      public DecimalField(int columns, int places)
      Constructs a DecimalField object.
      Parameters:
      columns - the number of columns available for text characters
      places - the number of decimal places to display
  • Method Details

    • getValue

      public double getValue()
      Gets the value from the text field.
      Returns:
      the value
    • setValue

      public void setValue(double value)
      Formats the specified value and enters it in the text field.
      Parameters:
      value - the value to be entered
    • setDecimalPlaces

      public void setDecimalPlaces(int places)
      Sets the decimal places for this field.
      Parameters:
      places - the number of decimal places to display
    • setMinValue

      public void setMinValue(double min)
      Sets a minimum value for this field.
      Parameters:
      min - the minimum allowed value
    • setMaxValue

      public void setMaxValue(double max)
      Sets a maximum value for this field.
      Parameters:
      max - the maximum allowed value