Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I have a JTable that has many number of columns with the CheckBox at the first column of each row. I can delete / commit changes by selecting the check box at the the first column. Since my Jtable has many columns, users have to navigate to the far left to check the CheckBox after making modifications in the row.
Is there a Freeze Pane (as in Microsoft Excel) for columns concept in JTable? The JTable is in a scroll pane so if I move to the far right of the JTable will the check box first column also come along?
Note - I use CheckBoxRenderer to get the CheckBox in the first column.
Also you could customize your contentpane to add 2 Jtables, one with checkbox and 2nd Jtabel with rest of the columns, when you scroll your horizontal bar, capture the mouse click event and reset the coordinates for Jtable1 to be in a visiable area.....
Sounds more complicated then previous post...but this also resolves your issue.
I tried Rob Camick's Fixed Column Table but ran to some issues.
1. Since my first column Header is rendered by CheckBoxRenderer. Now if I check CheckBox in the first column header currently it selects all the check box in the first column (its a Check All / Deselect All) Check Box. This functionality does not work if I integrate with FixedColumnTable code like below
2. Some of the check boxes in the bottom go missing in the first column - Please see attached Screen Shot.
3. The first column goes till the scroll pane length and not stop with JTable's length - Please see attached Screen Shot.
I will try the second solution ( making 2 Jtables in my code) and let you know the results.
I fixed the issues i ran while trying to implement Rob Camick's FixedColumnTable. My bad - the issues were due to my custom main table configurations & were rather easy to fix.
Ok now the stupid fixes -
1. Removed CheckBoxRenderer from my main table & gave it to the Fixed Table
2. Made the row height of both main table & Fixed Table to be the same. This ensures check box & other columns were in same line
3. Changed Fixed Table's Background to match the main table background + scrollpane background and thus the grey shade went away.
One more issue if faced & fixed ->
4. While sorting on the main table, the sort does not apply to the checkbox column in the Fixed Table. Solution is to assign the main table sorter to the Fixed Table Sorter.
Thanks to Darryl Bruke to lead me to the solution & Arun for giving an alternative.
Hi, I found this post very useful as it met my requirements. But i am blocked only at one point.
Grey colour is not getting removed from my fixed Table.
I am attaching the screenshots. please let me know, how this can be achieved.