/**
*
StringTableModel1Col JAVA jtable table model for one column of data all of type string
@author tushar.kapila at gmail .com
*/
package xmltagger.common;
import javax.swing.table.*;
import java.util.*; import javax.swing.*;
import java.util.*; import javax.swing.*;
public class StringTableModel1Col extends AbstractTableModel{
ArrayList<String> data = new ArrayList<String>();// need array of arrays for multi col
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex){
int rowIndex,
int columnIndex){
if(rowIndex >= data.size()){
int toAdd = rowIndex - data.size();
for(int i = 0; i < toAdd; i++){
data.add("");
}
}
data.set(rowIndex,(String)aValue);
}
int toAdd = rowIndex - data.size();
for(int i = 0; i < toAdd; i++){
data.add("");
}
}
data.set(rowIndex,(String)aValue);
}
public int getRowCount(){
return data.size();
}
public int getColumnCount(){
return 1;
}
public Object getValueAt(int row, int column){
return data.get(row);
}
return data.size();
}
public int getColumnCount(){
return 1;
}
public Object getValueAt(int row, int column){
return data.get(row);
}
}
No comments:
Post a Comment