java - How to add column with header and data to the JTable -
i created class mytablemodel extends abstracttablemodel. , want is, have initialized 3 columns data? defaulttablemodel had option, use method takes paramater columnname , columndata addcolumn(object columnname, object[] columndata)
, what's best way this?
in table model can have return want. if have 3 list<string>
or 1 list<threepropertypojo>
have table model methods answer correctly:
- number of columns 3
- number of rows
list.size()
- display value cell (row,col) used
list1.get(row)
(or 2 , 3 depending on 'col') or depending on value of 'col' particular property list element.
that pretty it.
there lots of examples if google "java swing tablemodel example"
http://www.javalobby.org/articles/jtable/ has nice example.
Comments
Post a Comment