Hello
I am new to Java Programming
I am facing a problem which i did not know how to solve so i need help from experts of this forum
I have JTable of lets say 5 columns and from that i want to hide some columsn e.g i want to get only column 0(or ist column) and column 5(5th column) visible to me and not the inbetween columns(i.e 2,3,4) so i coded it like this:
for(int count=0;count< ConnectedDrivestable.getColumnCount();count++)
{
tcm = ConnectedDrivestable.getColumnModel();
cm=tcm.getColumn(count);
if( count==0 || count==4)
{
cm.setPreferredWidth(15);
cm.setMinWidth(0);
cm.setMaxWidth(15);
}
else {
//ConnectedDrivestable.removeColumn(cm);
//ConnectedDrivestable.removeColumn(tcm.getColumn(count));
cm.setPreferredWidth(0);
cm.setMinWidth(0);
cm.setMaxWidth(0);
}
}
where ConnectedDrivestable is my JTable of lets say 5 rows and 5 columns
tcm is TableColumnModel and cm is TableColumn object
But the problem is that i am getting vertical line in between and that is the intersection line of column 1 and column 5(i.e the intersection line of two columns that are visible) i dont want this in between vertical line to appear
I really dont know how to fix this problem i have searched on internet but unable to find the appropriate solution to it
Also as shown in my code i tried to work with removeColumn method which documentation says should remove the desired columns but i dont know why it is not functioing for my case the way i acpected am i doing something wrong or?
So urgent help from people here is required
Thanks in advance
Imran