• Post Reply Bookmark Topic Watch Topic
  • New Topic

Disabling a cell in JTable  RSS feed

 
nirmal Rchavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
How do i disable a single cell in a JTable?
I hava tried with //table.setCellSelectionEnabled(false);
problem with this is, all the cells are disabled
//table.getComponentAt(row,column).setEnabled(false);
problem remains the same.
I have made use of TableCellRenderer interface.
Is there any method or API that disables the particular cell without effecting others.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
nirmal Rchavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mike,
Sorry for not providing the complete information.
This is a calendar application, and the method

/*public boolean isCellEidtable(int row,int column)
{
return false;
}*/
always should returns false. All i wanted is to restrict any action on a particular cell.(for example: a cell containing a particular date(say august 24)should be unseletable).

appretiate your help.
 
nirmal Rchavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mike,
Sorry for not providing the complete information.
This is a calendar application, and the method

/*public boolean isCellEidtable(int row,int column)
{
return false;
}*/
always should returns false. All i wanted is to restrict any action on a particular cell.(for example: a cell containing a particular date(say august 24)should be unseletable).

appretiate your help.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
simple demo, add a few values to the table, make one of the cells "3"

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!