• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextField  RSS feed

 
Jesse Walker
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way that you can take an input from a JTextField and test to see if it is an int, string, or char?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JTextField will give you a String to work with (returned by the getText method). You can test this String to see if it's parsable as an int.
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


If this code doesn't work, don't spend a lot of time, let me know and I'll fix it.

[ November 30, 2006: Message edited by: Kaydell Leavitt ]
[ November 30, 2006: Message edited by: Kaydell Leavitt ]
 
Jesse Walker
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code complies, I am running into another error but am researching. Thanks I will let you know if I get a logic error or not
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a suggestion at the top of the beginners forum...
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.

This is the kind of thing that you can learn a lot from working through yourself. If you have questions along the way, we're certainly here to help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!