How to make a columns in JTable Invisible for Swing Java

前端 未结 8 1441
半阙折子戏
半阙折子戏 2020-12-03 04:44

I have designed one GUI in which I have used one JTable from which I have to make 2 columns invisible . How should I do that ?

8条回答
  •  -上瘾入骨i
    2020-12-03 05:09

    i had the same problem and because of i am using TableColumnModel removColumn(); does'not help me so i used this

    table.getColumnModel().getColumn(0).setWidth(0);
    table.getColumnModel().getColumn(0).setMinWidth(0);
    table.getColumnModel().getColumn(0).setMaxWidth(0); 
    

    and worked fine for me it hide a column 0 and i still able to get value from it

提交回复
热议问题