As I understand it, JTextField only takes Strings. However, I need to ouput an int to it. I can think of some convoluted ways to do that, but I'm assuming there is an easier way to go about this that I'm clearly missing.
Any suggestions where I can look to find this answer or is there some already cooked code people use to make a quick conversion?
I'd use String.valueOf(myInt) myself, but that does call Integer.toString(myInt, 10). Which in turn calls Integer.toString(myInt) (radix 10 is a special case).
So if we want to use the most efficient one, then I think Integer.toString(myInt) will be the best.
Also, we may want to use a NumericTextField. Our parsing is then guaranteed to succeed. EDIT: oups, it seems you use the field for output only! [ November 23, 2008: Message edited by: Andre Uhres ]