This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Hi guys !! I really need your help here .. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Hi guys !! I really need your help here .." Watch "Hi guys !! I really need your help here .." New topic
Author

Hi guys !! I really need your help here ..

Meghna ks
Ranch Hand

Joined: Mar 15, 2001
Posts: 122
Hi people
I have a bean with Labels and textfields together. The data inside the textfields is a Vector of Objects. I need to be able to get the textfield to accept different datatypes depending on other dependencies like :
The value in the textfield depends on the value of another attribute called syntax which is of type string. For eg.
if syntax => "Integer" then textfield =>accepts only integers
if syntax => "String" then textfield => acceps only strings
if syntax => "Date" then textfield should be formatted with a combobox to set up a calender and select the date
How do I get the textfield to accept :
1. A String datatype only
2. An Integer datatype only
3. A Date datat type only
4. An IPAddress formatted value
Thanks
Meghna
prasadsvja
Greenhorn

Joined: Mar 26, 2001
Posts: 3
You have to implement PlainDocumentModel on your JTextField.
May be you can have a overloaded constructors for your text field with datatypes you are expecting as parameters.Hope this is clear to you
 
wood burning stoves
 
subject: Hi guys !! I really need your help here ..
 
Similar Threads
A Special TextEdit control for Date
How to format a textfield to accept different data types?!!
How to format a textfield to accept different data types?!!
Here are the dependencies Madhav .
How to format a textfield to accept different data types?!!