Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Left most column locking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Left most column locking" Watch "Left most column locking" New topic

Left most column locking

Narayanan Jayaraman
Ranch Hand

Joined: Apr 09, 2003
Posts: 52
Can some one tell me how to lock the left most column in JTable ? Thanks
Abhik Sarkar
Ranch Hand

Joined: Jun 14, 2003
Posts: 61
Hi Narayanan,
What do you mean by lock... diallow editing or disallow moving?
If it is disallow editing, you could override the isCellEditable method of your table model in such a way that it returns false only for that column:

Hope I understood your query correctly.
Narayanan Jayaraman
Ranch Hand

Joined: Apr 09, 2003
Posts: 52
Hi Abhik,
When scrolling table columns to the right, I want to lock the 1st column in the table, so that user can see the first column always, even when they scroll the other columns. Thanks
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

Hi Narayanan,
It appears that you haven't yet discovered Tamemusa's Swing examples
(Look for the "Fixed Column" example at the bottom of that Web page!)
Hope it helps.
Good Luck,
I agree. Here's the link:
subject: Left most column locking
It's not a secret anymore!