Possible duplicate:
How to make columns in JTable Invisible for Swing Java
How to hide a column in the DefaultTableModel column with its display in the table?
I am trying to enter data into three columns in JTable, but I want to show only two columns. In fact, I want to hide the third column, not by setting the width to 0, but by any other method in which I can get data from a hidden column on a click event.
How can I hide a column this way?
I am using the following code:
try { String Title[]= new String{"a","b","c"}; Object obj= new Object[50][3]; JTable table= new JTable(obj,title); JScrollPane jsp= new JScrollPane(table); add(jsp); } catch(Exception ex) { ex.printStackTrace(); }
java swing jtable jscrollpane
Adesh singh
source share