File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Disabling an entire JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Disabling an entire JTable" Watch "Disabling an entire JTable" New topic

Disabling an entire JTable

Sumitra Venkat

Joined: Apr 07, 2001
Posts: 5
I need to disable an entire JTable i.e disallow the user to select any row, column or cell. Is there anyway of doing this?
Thanks in advance,
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Sumitra Venkat

Joined: Apr 07, 2001
Posts: 5
Hi Paul,
Thanks for your reply, but that's not quite what I wanted. I have a ListSelectionListener attached to the JTable, that keeps track of changes in row selection and displays the selected row's details in some textfields. For a particular circumstance, I don't want these details to be displayed in the textfields and hence want the JTable to be disabled so that the user cannot perform row selections. I tried out what you had suggested, but it still triggers the row changed event and displays the selected row in the textfields.
If you/anyone has knows some way of doing this, please do write.
Thanks in advance,
Ranch Hand

Joined: Jun 21, 2001
Posts: 57

Check for the particular circumstance and clear the selection of the table(which deselects selected columns and rows)using
try to manipulate with

San Su
Ranch Hand

Joined: Jul 06, 2001
Posts: 313

> I need to disable an entire JTable
Check out the following site..
Amit Agarwal
Ranch Hand

Joined: May 09, 2001
Posts: 92
Hi Sumitra,
there are three default editors associated with the class types. If you remove these associations, the JTable will become read-only. You can still select the cells /cols / rows as per your settings. The code for disabling is:

I agree. Here's the link:
subject: Disabling an entire JTable
jQuery in Action, 3rd edition