Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Best Practice using JTable

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please give any link, for the Best Practice using JTable.
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

it is best practice to manage the table content using the TableModel, not the methods in JTable that can change the content as well.

In a typical object oriented project you will find DefaultTableModel inconvenient. Often a table row represents an entity that is best represented as an interface type like Customer, Assignment, Student, Record. DefaultTableModel is not intended to support such a structure in the first place.

So you can make your own TableModel implementation. In most cases it is very convenient to use AbstractTableModel.

It is all described well in the Sun tutorial. However, when to use which way is not described in detail, thus my additional explaination.

Kai
 
reply
    Bookmark Topic Watch Topic
  • New Topic