TableModel to ComboBoxModel
hi,
i need a list of objects to be displayed in a table and a combobox.
i was thinking about a swingy solution to my problem (as copying the elements on each change is rather crappy code). so my solution was to use a ComboBoxModel to adapt the TableModel to the combobox.
I have a problem converting the getValueAt(int row, int column) of the tablemode tot the getElementAt(int index) of the ComboBoxModel..
anyone has ever done something like this? or maybe know a solution to my problem ? i think other people must have come across this problem already.. i couldn't find anything in the forum archive though..
greetings,
PJ
[670 byte] By [
phonkera] at [2007-10-2 10:22:34]

> I have a problem converting the getValueAt(int row, int column) of the tablemode tot the getElementAt(int index) of the ComboBoxModel..
Well how do you map a two dimensional table to a one dimensional table? Only you know what your requirement is.
I would suspect you would treat the index as the row number and then just hardcode the column number.
thanks for the reply
that was kinda my own conclusion too, i was trying to write a generic ComboBoxModel that would adapt a tablemodel.. but i guess i can't make i completely generic, i'll make the column number a property of the constructor when initializing the ComboBoxModel..
thx,
PJ