File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

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

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
I agree. Here's the link:
subject: Hi guys !! I really need your help here ..
It's not a secret anymore!