• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to handle Enumeration values in java.sql.Types ?!! Is it possible ?!!

 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I'm designing a JTable and using java.sql.Types to set the column data types for the Table(This is a design requirement !!)
If suppose the vector that is supposed to show data on the Table is of the type enum, then I need to display a combobox using with the Combobox values being the values of the vector of type enum. How do I do this ?!!
Thanks
Meghna
 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
Your problem is not clear, java.sql.Type does not have Enumeration type.
Enumeration is a Interface... do you mean, you want to populate
Combo box with enumeration data?
 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Mohana
Yes, I meant I want to populate the ComboBox with Enumeration data. The data type is of the data is "String".
Thanks
Meghna
 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
First thing is you need to create a combobox using this kind of constructor.
new JCombox(Vector vectCmbData);
In this Vector is the data to be dispalyed in combo box. assume that you stored a strings in the vector.
If you want to update the combo from enum interface
while(myEnum.hasMoreElements())
{
vectCmbData.add((String)myEnum.nextElement());
}
finally create a combo box with
new JCombox(Vector vectCmbData);
This is one time solution. if you want to update data more than one time for same combo box.. you need more to know.
hope this will help
Mohana
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!