JTable Colum标识符不会显示

时间:2018-04-25 14:37:26

标签: java swing user-interface jtable jpanel

为什么我的列标识符没有显示? 你只能看到没有更多的面板。

public class ListPanel extends JTable {

    private String[] titles = null;
    private DefaultTableModel model = null;

    public ListPanel() {
        initializeControls();
        this.setVisible(true);
    }

    public void initializeControls() {
        this.titles = new String[] { "Kategorie", "Fach", "Beschreibung", "Von", "Bis", "Erledigt" };
        this.model = new DefaultTableModel(titles,0); //auf eins gesetzt um zu testen 
        this.model.setColumnIdentifiers(this.titles);
        this.setModel(model);
    }
}

大型机中的代码:

private ListPanel tasktable = null;
tasktable = new ListPanel();
this.add(tasktable,BorderLayout.CENTER);

0 个答案:

没有答案