How to store multiple values in a JTable row as a JCombobox
Hashmap contains key and value(result of parsing an XML). Hashmap contains things in the way that key is a string and value is a vector. A key may have single value in the vector or mutiple values in the vector.
My question is:
This hashmap, has to be put into a jtable,such that if the key has single value, put it to text box. If it has multiple values insert a combobox in the row of that table.
I need the swing code for this problem
Not code but steps that can help you..
- Create a Table.
- Every time adding a new row check for the hashmap value and if it is a single value add textbox to that cell or add comboBox.
- Repeat step 2 for all hashmap keys.
References that can help you:-
- Adding row in table
- Adding comboBox in table
- JTable add/remove rows to custom table model (updating table display)