这是我收到的例外情况:
线程“AWT-EventQueue-0”中的异常 java.lang.ArrayStoreException
这是我的代码:
public class LeagueTable extends JTable {
public static final Dimension INITIAL_SIZE = new Dimension(500, 300);
public final String[] columnNames;
DefaultTableModel model;
JTable table;
public LeagueTable(){
DatabaseConnector listOfTeams = new DatabaseConnector();
columnNames = new String[]{"Teams", "Goal Difference", "Points", "Verdict"};
Object[][] data = listOfTeams.teamResults.toArray(new Object[listOfTeams.teamResults.size()][]);
model = new DefaultTableModel(data, columnNames);
table = new JTable(model){@Override
public boolean isCellEditable(int row, int column) {
return false;
}};
JScrollPane pane = new JScrollPane(table);
setVisible(true);
setSize(INITIAL_SIZE);
setLayout(new FlowLayout());
add(pane);
}
public String[] getStringArray() {
return columnNames;
}
}