• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DefaultTableModel and DefaultComboBoxModel

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use DefaultTableModel, or should I say extend it and make the necessary changes to make it use the DataInfo[] to show the data in the JTable.
Mark
 
Sam O'Neill
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark - so you think that the use of Vectors is perfectly ok?
Sam
 
reply
    Bookmark Topic Watch Topic
  • New Topic