Hi,
ich habe eine ganz einfache Tabelle
{
public static JTable table;
public AusgabeTabelle() {
super("Ausgabe");
addWindowListener(new WindowClosingAdapter());
table = new JTable(DATA, COLHEADS);
Container cp = getContentPane();
cp.add(new JLabel("keine Ausgabe"), BorderLayout.NORTH);
cp.add(new JScrollPane(table), BorderLayout.NORTH);
}
public static void main(String[] args) {
AusgabeTabelle frame = new AusgabeTabelle();
frame.setLocation(100,100);
frame.setSize(400,200);
frame.setVisible(true);
}
}```
im TableData steht:
```public interface TableData
{
public static final String[][] DATA = {
{" 5/1988", "263", "BeispielText1"},
{" 6/1988", "231", "BeispielText2"}
};
public static final String[] COLHEADS = {
"DAtum", "Seiten", "Text"
};
}```
soweit so gut funktioniert auch alles, aber ich möchte jetzt einfach eine Spalte hinzufügen und zwar durch hinzufügen eines Wertes beim String[] COLHEADS:
```public static final String[] COLHEADS = {
"DAtum", "Seiten", "Text", "neueSpalte"
};```
wenn ich das mache kommt aber leider die `ArrayIndexOutOfBoundsException: 3`