Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable edit on certain columns in a JTable

Tags:

java

swing

jtable

I would like to disable certain columns in my JTable, I know how to disable them all, but this is not what I need. I Have 4 columns

The 'Accepted' column is a checkbox and I would like that to stay editable but the rest should not. Any ideas?

 |Name    | Address  | Phone  | Accepted |
 -----------------------------------------
  Bob       Random     45678    Yes

Thanks you :)

like image 230
user1724416 Avatar asked Sep 02 '25 10:09

user1724416


1 Answers

I figured it out

        public boolean isCellEditable(int row, int column) {
            return column == 3;
like image 183
user1724416 Avatar answered Sep 04 '25 23:09

user1724416