Results 1 to 5 of 5
Thread: Jtextfield Validation
- 12-09-2010, 08:12 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 4
- Rep Power
- 0
- 12-09-2010, 08:26 AM #2
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
I would suggest,
Why you dont want to use if else condition? Can you use other conditional statement?Java Code:textField.setText("0");
If you want to set text to JTextfields that has empty string then you will need to use conditional statement.
- 12-09-2010, 08:42 AM #3
Have you thought about what you would want to happen when the JTextField (NOT Jtextfield) displays 0 and the user types a character?
To answer your question, use an appropriately coded DocumentFilter. Override remove(...) and replace(...) to call the super implementation, check whether the JTextField's text isEmpty() and conditionally call insert(...) to insert "0"
db
- 12-09-2010, 09:22 AM #4
Member
- Join Date
- Dec 2010
- Posts
- 4
- Rep Power
- 0
Thanks to all for the quick reply
I am newbie in Java Programming. Its fine to use conditional Statement. I thought some other way to implement this without the conditional statement.
- 12-10-2010, 08:55 AM #5
Similar Threads
-
Which one is better for navigation and validation
By anilkumar_vist in forum New To JavaReplies: 1Last Post: 10-18-2010, 05:21 AM -
how to access jTextField of one JFrame1 from JFrame2 & Modify JTextField contents
By sumit1mca in forum AWT / SwingReplies: 1Last Post: 01-30-2009, 06:44 PM -
VAlidation
By chetna1982 in forum New To JavaReplies: 2Last Post: 12-11-2008, 07:08 AM -
Need Help On Entry Validation
By obdi in forum New To JavaReplies: 3Last Post: 07-25-2008, 06:39 AM -
form validation
By abhiN in forum New To JavaReplies: 0Last Post: 03-07-2008, 07:04 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks