TableColumn column1 = null; column1 = JTable1.getColumnModel().getColumn(no. of the col you want to hide); column1.setMaxWidth(0); column1.setMinWidth(0); column1.setWidth(0); column1.setPreferredWidth(0); Hi keiyia .. You could try this code to hide the column you want. To unhide them, you could try the same code & set the max, min, width & preferredwidths to the required dimension in the condition you want the columns to show. for eg; TableColumn column1 = null; column1 = JTable1.getColumnModel().getColumn(no. of the col you want to hide); column1.setMaxWidth(100); column1.setMinWidth(10); column1.setWidth(100); column1.setPreferredWidth(100); Thanks Meghna
i have the capability of hiding them, but just can't get them back. ok, here's the situation: i have a split pane witha table on one side. on the menubar is a view option. it has 4 checkbox menuitems. i need for the the appearance to change everytime an item is selested or deselected. if selected, it needs to be hidden (which i already had). if deselcted, return as to original state (which i can't get to worked).
This is another way of doing it. Sets the 1st column to invisible. DefaultTableColumnModel columnModel = new DefaultTableColumnModel() { public void addColumn(TableColumn tc) { boolean first = true; if (first) { first = false; return; } super.addColumn(tc); } }; table.setColumnModel(columnModel);
Don't get me started about those stupid light bulbs.