Results 1 to 2 of 2
- 07-16-2007, 10:04 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 26
- Rep Power
- 0
Problem with JTextFields not null
I have a some JTextFields that I want to verify the contents of. IF the field is left blank it will add a message to my error window ELSE it will preform another check.
The OTHER check works fine, but it never seems to give me the proper error message if the field is blank, it immediatly goes to the ELSE statement.
If I do a, the variable appears to be NULL.Java Code:System.out.println(variableName);
if I manually set animationDelay = null; the proper error message is displayed.Java Code://animation delay is the name of the textfield animationDelay = this.animationDelay.getText(); /* check if animation delay was left blank */ if (animationDelay == null || animationDelay == ""){ errMsg.add("Please enter disk Animation Delay"); } else { /* check if the input given is valid */ try { /* parse the animation delay entered into an integer */ int animationDelayInt = Integer.parseInt(animationDelay); /* check range of animation delay */ if (animationDelayInt < MIN_ANIMATION_DELAY){ errMsg.add("Animation Delay must be greater than 0"); } else if (animationDelayInt > MAX_ANIMATION_DELAY){ errMsg.add("Animation Delay must be less than " + MAX_ANIMATION_DELAY); } } catch (NumberFormatException ex) { errMsg.add("Animation Delay must be a Number"); }
why is the blank field not being detected as null?
Is there an invisible character that blank JTextFields insert in order to ruin my life?
Thanks
- 08-07-2007, 05:17 AM #2
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Similar Threads
-
NULL Value Of parameters
By riders in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-14-2008, 02:29 PM -
Comparing null problem
By thirdy_veritech in forum New To JavaReplies: 2Last Post: 02-06-2008, 08:46 AM -
What is NULL
By bugger in forum New To JavaReplies: 1Last Post: 01-09-2008, 04:55 PM -
parameters=null
By mary in forum Java ServletReplies: 1Last Post: 07-13-2007, 04:29 PM -
JTextFields with username & password.
By Eric in forum AWT / SwingReplies: 2Last Post: 07-01-2007, 11:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks