java - Getting column names from an AbstractTableModel -


i can't figure out using constructor jtable(tablemodel dm).

i'm using linkedlist manage data so, display it, extended abstracttablemodel:

public class volumelisttablemodel extends abstracttablemodel {      private static final long serialversionuid = 1l;     private linkedlist<directory> datalist;     private object[] columnnames= {"id", "directory", "wildcard"};       public volumelisttablemodel(){     }      public void setdatalist(linkedlist<directory> temp){         this.datalist = temp;     }      public linkedlist<directory> getdatalist(){         return (linkedlist<directory>) this.datalist.clone();     }      public object[] getcolumnnames() {         return this.columnnames;         }      @override     public int getcolumncount() {         return directory.numcols;     }      @override     public int getrowcount() {         return this.datalist.size();     }      @override     public object getvalueat(int row, int col) {          directory temp = this.datalist.get(row);          switch(col){         case 0:             return temp.getid();         case 1:             return temp.getpath();         case 2:             return temp.getwildcard();         default:             return null;                 }     } 

i'm doing wrong because when run gui column names labeled a,*b*,c.

there no method in abstracttablemodel called getcolumnnames, believe method being ignored. actual method want override getcolumnname method.

try adding method volumelisttablemodel class

public string getcolumnname(int column) {     return columnnames[column]; } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -