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:

  1. number of columns 3
  2. number of rows list.size()
  3. 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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -