Results 1 to 2 of 2
- 11-28-2012, 08:42 AM #1
Member
- Join Date
- Nov 2012
- Posts
- 40
- Rep Power
- 0
Validate user input (positive and numerical)
I can't figure out a way to validate user input. The input needs to be both positive and numerical.
So far the code won't accept any letters, but it still accepts negative numbers.
I am a total noob here and the books I have don't seem to cover this. Actually, both books don't seem to cover much of anything I need.Java Code://Get input (minutes and payment) from user try{ minutesIn = Double.parseDouble(minutesField.getText()); paymentIn = Double.parseDouble(paymentField.getText()); } catch(Exception e) { return; }
- 11-28-2012, 10:00 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Similar Threads
-
Allow only numerical input on JTextField
By patriotsfan in forum AWT / SwingReplies: 3Last Post: 05-31-2011, 12:39 PM -
How to validate user to make sure he is connected to database?
By sandeep43 in forum Advanced JavaReplies: 2Last Post: 05-24-2011, 10:15 AM -
Sum positive numbers using 10 inputs from user
By pvictory1 in forum New To JavaReplies: 15Last Post: 10-10-2010, 01:30 AM -
Program to validate a user against LDAP for login Authentication
By syntel in forum Java ServletReplies: 2Last Post: 05-18-2010, 03:12 PM -
How do I validate user input from forms with Java?
By rickywh in forum New To JavaReplies: 2Last Post: 01-30-2010, 06:49 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks