• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable

 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sirs,
how to disable a perticular cell in a JTable ?


thanks in advance,
Francis Varkey
 
R.Joe
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by using the AbstractTableModel method isCellEditable(int row, int col)

syntax

public boolean isCellEditable(int row, int col)
{
if (col == 0)
{
return true;
}
else
{
return false;
}
}
 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,
This is working under some fixed conditions. But my cell selection is dynamically. That is, in first row some times first two columns are editable, and in second row first three columns are editable and in third row only first column is editable ... and so on...

how to solve this problem ?

regards francis
 
Brian Cole
Author
Ranch Hand
Posts: 908
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what's the problem with public boolean isCellEditable(int row, int col)?

It gives you the row number and the column number, so there's no problem doing different things on different rows. Or do you mean something else by "disable" in the original post?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic