artofillusion.ui
Class ValueField

java.lang.Object
  extended by BTextField
      extended by artofillusion.ui.ValueField

public class ValueField
extends BTextField

A ValueField is a BTextField used for entering a numerical value. Constraints can be specified for the value, for example, that it must be positive. If an illegal value is entered into the text field, the text turns red to indicate this.


Field Summary
static int INTEGER
           
static int NONE
           
static int NONNEGATIVE
           
static int NONZERO
           
static int POSITIVE
           
 
Constructor Summary
ValueField(double value, int constraints)
           
ValueField(double value, int constraints, int columns)
           
ValueField(float value, int constraints)
           
ValueField(float value, int constraints, int columns)
           
 
Method Summary
 void checkIfValid()
          Recheck the current value to see if it is valid, and set the text color accordingly.
 double getValue()
          Get the current value in this field.
 ValueChecker getValueChecker()
          Get the ValueChecker for this field.
 boolean isTextValid()
          Determine whether the text entered in the field is a valid number.
 boolean isValid(double val)
          Determine whether a particular value is valid for this field.
 void sendValidEventsOnly(boolean validOnly)
          Set whether this field should send out all ValueChangedEvents, or only those which result in valid entries (the default).
 void setMinDecimalPlaces(int decimals)
          Set the minimum number of decimal places to display.
 void setValue(double val)
          Set the value in this field.
 void setValueChecker(ValueChecker vc)
          Set a ValueChecker to be used for determining whether the value is valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

NONNEGATIVE

public static final int NONNEGATIVE
See Also:
Constant Field Values

NONZERO

public static final int NONZERO
See Also:
Constant Field Values

POSITIVE

public static final int POSITIVE
See Also:
Constant Field Values

INTEGER

public static final int INTEGER
See Also:
Constant Field Values
Constructor Detail

ValueField

public ValueField(double value,
                  int constraints)

ValueField

public ValueField(float value,
                  int constraints)

ValueField

public ValueField(float value,
                  int constraints,
                  int columns)

ValueField

public ValueField(double value,
                  int constraints,
                  int columns)
Method Detail

setValueChecker

public void setValueChecker(ValueChecker vc)
Set a ValueChecker to be used for determining whether the value is valid. The value must satisfy both the ValueChecker *and* any other constraints to be considered valid.


getValueChecker

public ValueChecker getValueChecker()
Get the ValueChecker for this field. Returns null if none has been set.


isTextValid

public boolean isTextValid()
Determine whether the text entered in the field is a valid number.


isValid

public boolean isValid(double val)
Determine whether a particular value is valid for this field.


checkIfValid

public void checkIfValid()
Recheck the current value to see if it is valid, and set the text color accordingly.


getValue

public double getValue()
Get the current value in this field.


setValue

public void setValue(double val)
Set the value in this field.


setMinDecimalPlaces

public void setMinDecimalPlaces(int decimals)
Set the minimum number of decimal places to display.


sendValidEventsOnly

public void sendValidEventsOnly(boolean validOnly)
Set whether this field should send out all ValueChangedEvents, or only those which result in valid entries (the default).



Copyright © 1999-2011 by Peter Eastman.