Click to See Complete Forum and Search --> : enter range of Float in JTextField?


majid
April 9th, 2000, 12:57 PM
Hi, I need to have a JTextField to enter Float like:
0.1, 0.2, 0.4, 0.6
I don't know how to get those numbers in a vector from this JTextField.
Thanks

poochi
April 9th, 2000, 05:00 PM
If you have a string in this format "0.1, 0.2, 0.4, 0.6" , you can use StringTokenizer to
parse this string.



// "," is the Delimiter
StringTokenizer sTokenzier = new StringTokenizer( strUnFormatedString , "," );
while( sTokenzier.hasMoreTokens()){
String strFirstToken = sTokenizer.nextToken(); // you will get "0.1"
}





Poochi..