Hi all! I am extending JTextField to allow only certain types and ranges of input (for example, only allow integers in the range 0-255). If no range is specified in the constructor, I want the default range to be the range allowed by the type. For integer, I have used Integer.MIN_VALUE and Integer.MAX_VALUE to get this range. When I get to float and double, this won't work because Float.MIN_VALUE returns the smallest positive value of type float instead of smallest overall value. Same for Double.MIN_VALUE. Does anyone know of methods I could call to obtain the minimum values for float and double, or must I hardcode it? Any advice is much appreciated. Thanks. Stephaie

Hi, Stephanie. Can't you just refer to -Float.MAX_VALUE and -Double.MAX_VALUE? According to Java in a Nutshell, the range for floats is +/-1.4E-45 to +/-3.4028235E+38 and for doubles is +/-4.9E-324 to +/-1.7976931348623157E+308. So if you're looking for the maximum negative value (in magnitude), I think it'd be safe to simply use the negative of MAX_VALUE. Note, for the integral cases (byte, short, etc.), this approach does not apply. Is this what you're looking for? Art

I think the absolute value of the Minimun for each type is one more than the maximum. For example, byte range is -128 to 127. So, you may want to add 1 to Max before you use the negative of it. [This message has been edited by herb slocomb (edited March 21, 2001).]