File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Adding checkbox to some selected row of a column. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding checkbox to some selected row of a column." Watch "Adding checkbox to some selected row of a column." New topic
Author

Adding checkbox to some selected row of a column.

Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
Hello,

I am having an issue related to checkbox in JTable. Although i searched it in the forum, but solution was not there and no relevant suggestion found.

1. I want to add checkbox in some selected row, i.e I have a JTable with 3 column , 1st column is checkbox, second is String and third is value like 1,2,2,1,2.

Now I want to show checkbox (In First column )only in rows where there is value of 1 against it in column 3rd.
My value in table is added dynamically using collection.



Although I am able to mark it not editable using following code


But what i want is checkBox either be showing dimmed or not visible for this particular value (1) in the 3rd column.

Help would be appreciated as its urgent..
Thanks in advance.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

The cell renderer must display the check box differently. This means you cannot use the default boolean cell renderer. Fortunately you can wrap it:
Combined with the model's isCellEditable method as you have it this should work.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Adding checkbox to some selected row of a column.