There are many ways to do this. here are some
A) override the isCellEditable(row,column) method on TableModel to return
false for that column
B) set a CellEditor on the column that overrides isCellEditable(event) to
always return false
C) Override editCellAt(row,column,[event]) on JTable to always return on the
specified column
D) set the CellEditor on the column to null (as seen below) (BTW the
setBackground is a bad idea across L&Fs)
Hope one of these works for you
-----Original Message-----
From: Mario Fernandes (IT Dept. - Langley) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 11:12 AM
To: '[EMAIL PROTECTED]'
Subject: JTable difficulty
Hi
I found your mail address on the askjeeves website. I am searching for a way
to disable a JTable column from being edited. You had answered a similar
doubt a couple of years ago.
TableColumn tCol = table.getColumn("Sport");
DefaultTableCellRenderer tColRend =
(DefaultTableCellRenderer)nCol.getCellRenderer();
tColRend.setBackground(Color.gray);
tCol.setCellEditor(null);
The above is code that I found in a mail from Prakash Muthukrishnan
asking Tony of LaPaso Cyclone Software Corporation Scottsdale, Arizona USA
for a solution.
I would appreciate an early reply to this problem.
Regards
Mario Fernandes
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing