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 Disabling the JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Disabling the JTable" Watch "Disabling the JTable" New topic

Disabling the JTable

Fabricio Sanchez
Ranch Hand

Joined: Mar 11, 2003
Posts: 33
Hi there,
I hope this is a quick one...
I would like to mimmic the way a button is disabled in swing (i.e. it goes a darker shade of grey and processes no event) in a JTable. I like the changing of the color as it lets the user know that he can't use the component.
In my JTable instance called table, I have tried to

But that only disables table selection events and does not change any colour (that is, it still looks active to me).
What can I do to get the disabled look I want?
Do I have to set the backgroud colours myself to gray(disbaled) then back to white(enabled) again?
Do I have to remove listeners and then add them again? (For example I have a mouseListener placed on the table column header that I would like to disable also).
Thank you!
I agree. Here's the link:
subject: Disabling the JTable
It's not a secret anymore!