Originally posted by Tapan Maru: I am having a JTable which is instantiated from a TableModel
Now i want that user should not be able to move first column. all other columns can be rearranged in the table.
Is there any way to restrict the user by disabling movement of the first column?
The simple way to handle this is by changing the behavior of the moveColumn() method of the table's column model. For example:
This will prevent the first column from being reordered, but there may be some visual flaws. If the user attempts to drag the second column leftward to be the first, s/he will be prevented from doing so but may experience some odd visual jumping. To clean that up is possible but is more work.
Originally posted by Darryl Burke: I googled JTable fixed column and got more hits than I could read in a lifetime.
In my experience, most people looking for a "fixed column" are worried about scrolling, not reordering. They want one or more leftmost columns to stay put while the horizontal scroll bar moves the others. A typical side-effect of this is that the first column can't be reordered, but it's a different kind of thing. [ June 09, 2008: Message edited by: Brian Cole ]