File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Making JTextField accept an INT?
Joined: Oct 24, 2005
Mar 24, 2006 07:36:00
Is this possible?
I'm trying to use the set text method to put an integer value in a
and getting the incompatibility error, is this possible or is there another method I'm not aware of?
Joined: Jan 17, 2006
Mar 24, 2006 07:43:00
you could use:
myTextField.setText("" + myInt);
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Joined: Sep 16, 2005
Mar 24, 2006 07:45:00
You can use String.valueof(integer), or use
's format method if you want commas added: 12,333 etc...
There is no emoticon for what I am feeling!
I agree. Here's the link:
subject: Making JTextField accept an INT?
length of a jtextfield
Setting Up a JTextField to only accept Integers - Solution! (with Questions)
Which data structure is best suited for this?
Setting hot keys
cloning swing components
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015