posted 21 years ago
Hi Everyone!
Has anyone used either the DefaultTableModel or defaultComboBoxModel in their GUI implementations? I have read several threads where people have said that Vectors are outmoded and are not too desirable due to their synchronization which I don't need but at the same time to implement my own table and combobox models could be construed as reinventing the wheel by Sun if the default versions could have been used.
My reason for providing my own table model was that I want to just pass the DataInfo[] objects array straight back to the GUI and have a method in my table model to receive it with the following signature:
public void setDataRecords(Datainfo[] data)
I can then extract the headers and the data into my model in one go. I was planning to store the data internally in the model in an array as I will never be adding a record one at a time so no need for dynamic resizing and no need for converting between a List and arry to index into it.
I want to do the same with my combobox model for the origins and destinations so they can be assigned all at once each time with a method call:
public void setListItems(Set items)
Again I have no need for dynamic resizing of the list so could store in an array.
The point is I COULD just use the Default models and pass the data in the manner expected by them but then they use Vectors and provide a whole heap of functionality I neither need nor want to encourage such as dynamic resizing.
Does anyone have any thoughts on this as don't want to reinvent anything but at the same time want something more tailored to my application's needs.
Many thanks in advance
Sam