• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best Practice using JTable

 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please give any link, for the Best Practice using JTable.
 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!