aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes This is really bad => How to add a combobox to an existing textfield dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "This is really bad => How to add a combobox to an existing textfield dynamically" Watch "This is really bad => How to add a combobox to an existing textfield dynamically" New topic
Author

This is really bad => How to add a combobox to an existing textfield dynamically

Meghna ks
Ranch Hand

Joined: Mar 15, 2001
Posts: 122
Hi I have designed a bean with a combination of labels and textfields . The value of the textfield is dependent on certain other attributes. So
1. If one of these other attributes is a string, the textfield should accept only strings
2. If one of these other attributes is an Integer, then the textfield should accept only integers.
3. If one of these other attibutes is a combobox, then a combobox with diff. choices should show up.
How do I get the textfield to function this way. Please help. An example code would be great for understanding the concept.
Thanks
Meghna
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
What is often done, is that you put a "submit" button on your GUI. Then when the user is done with their input and clicks the button, you can edit the contents of each field and send back appropriate error messages. This method does not PREVENT the user from inputting incorrect stuff, but you just don't accept it.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: This is really bad => How to add a combobox to an existing textfield dynamically
 
Similar Threads
Here are the dependencies Madhav .
how do I make a single cell of the second column to accept different data types ?!!
ComboBOx
How to set the data type of an IPAddress & Date/Time
Hi guys !! I really need your help here ..