• Post Reply Bookmark Topic Watch Topic
  • New Topic

Disabling a cell of the JTable  RSS feed

 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

How to disable a single cell in a JTable?

If we have buttons in a column, how to disable a single button?

please help!
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
button.setEnabled(false);
 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

But I want to disable a cell of the table
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If we have buttons in a column, how to disable a single button?


But I want to disable a cell of the table

But if you have buttons in a column, what is the difference? You just use the disable code in your cell renderer.
[ August 04, 2005: Message edited by: Stuart Gray ]
 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would not work, it disables the whole Coloumn
 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.. Think we don't have button.

I just have to disable a random cell in the JTable how to do it?
 
Matan Mazursky
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u must use the table model and tell it not be changeable
 
Matan Mazursky
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Table Model has a method
public boolean isCellEditable(int row, int column)
so you can override this method using your own class, etc.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!