JTable duplicate values in row

前端 未结 3 1058
春和景丽
春和景丽 2020-11-21 13:43

I have a JTable populated with a custom DataModel (pasted below) and when I call the populate() method, it appears to populat

3条回答
  •  情歌与酒
    2020-11-21 14:08

    1) your TableModel is un_completed, I miss there lots or required methods for JTable's life_cycle, starting with TableHeader etc.

    2) since there are lots of AbstactTableModels based on HashMap, I'd suggest to return arrays type implemented in API directly

    Vector> data; 
    
    String[][] or Object[][] 
    

    instead of

    ArrayList> data;
    

    simple explanations is that XxxList returs column and Vector or String[] returns Row

    3) I'd suggest to use DefaultTableModel directly then you'll never need to solve duplicates or missed column/row

提交回复
热议问题