This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 19541
    
  16

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding checkbox to some selected row of a column.
 
Similar Threads
JCheckBox in JTable
Checkbox not working in JTable.
JTable - selecting multiple rows by selecting checkbox column
Check box in a Table
Checkbox editor for JTable column