• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

AbstractTableModel how to read in header and row

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how would I be able to read in my Vector header and rows to this TableModel as in
DefaultTableModel model = new DefaultTableModel(rows, header);
TableModel model = new AbstractTableModel() {
public String getColumnName(int column) {
return (String)header.elementAt(column);
public int getRowCount() {
return rows.size();
public int getColumnCount() {
return header.size();
public Object getValueAt(int row, int column) {
String[] rowData = (String [])elementAt(row);
return rowData[column];
public boolean isCellEditable(int row, int col) {
return (col==1);
public void setValueAt(Object value, int row, int column) {
String newValue = (String)value;
String[] rowData = (String [])elementAt(row);
rowData[column] = newValue;
fireTableCellUpdated(row, column); //table event
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic