Here's the idea: Let's say I have a class extending TableModel
, with something like a List<List<String>> collection
field. On an event, I want to clear out a JTable
and re-add rows where one specific column is a combo box; the items in combo box n
are the items in the List<String>
from collection.get(n)
in my list. So I'm iterating over collection
adding rows, and I'm iterating over each collection.get(n)
adding combo box items.
There are no event listeners. When a separate button is clicked I can work out what needs to happen as long as I can getSelectedIndex
on each combo box.
I have spent two and a half hours turning my GUI into code spaghetti where I've extended virtually everything and I have maximum coupling on practically everything. I think I might even have two disjoint collections of JComboBox
instances. I say this to stress that it would do absolutely no good for me to post any code I currently have.
I have read the oracle tutorial on JTable, all of these that strangely don't have an explanation I can understand.
So basically I just need an idea of what I need, because I'm not getting anywhere with the resources I've found.
>. When ever a cell is edited, the table will want the editor component, it will pass the row and column indexes. Simple prepare ComboBoxModel, based on the values you need for the row, and seed that to the editor
– MadProgrammer Oct 23 '13 at 08:16