Getting ints out of TextFields

I need to be able to have the user write a number into a text field and then put that number into a int. Unforunately, as you probably know, TextFields only have GetString, no GetInt, so I was wondering if there was some soultion to allow me to take ints from TextFields or an objecct like a TextField. If this is not possible it would be nice to know how to convert Strings to Int (assumeing they hold only numbers of course) or at least how to find the ASCII value of a char so I could write a String to Int method myself.

[538 byte] By [AnyoneEB] at [2007-9-26 2:38:32]
# 1
Hi, you can use the method:Interger.parseInt(String s);This method returns the integer value of the String u put in and throws a numberformatexception when the string contains a non-number.HTH,Robert
borg-javadrone at 2007-6-29 10:09:31 > top of Java-index,Desktop,Core GUI APIs...
# 2
u have to use key listener's and disable char keys and hold only number keys and u'r problem will be solved
Rama at 2007-6-29 10:09:31 > top of Java-index,Desktop,Core GUI APIs...
# 3
how do you use keyListener to stop keys? I haven't done too much with it, sorry. Thanks to both of you for your help!
AnyoneEB at 2007-6-29 10:09:31 > top of Java-index,Desktop,Core GUI APIs...
# 4
Wait... what do you have to import for parseInt(String) to work? it doesn't like it on mine, I include Java.Applet.*, Java.awt.*, and Java.awt.event.*.
AnyoneEB at 2007-6-29 10:09:31 > top of Java-index,Desktop,Core GUI APIs...
# 5
I got it working, you spelled integer and I was just coping and pasting, thank you for the help no more reeplies needed!
AnyoneEB at 2007-6-29 10:09:31 > top of Java-index,Desktop,Core GUI APIs...