This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Custom CheckBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Custom CheckBox" Watch "Custom CheckBox" New topic

Custom CheckBox

seema chhetri
Ranch Hand

Joined: Feb 17, 2009
Posts: 43

Please can you tell me how i can use a custom CheckBox . and what is the code.

i want to put custom checkbox in My Jtree.

Thanks & Regards,
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10568

Like the JList and JTable, JTrees also use Renderers. You will need to provide a custom renderer which renders the required nodes as JCheckboxes instead of JLabels, which are the default.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
did you get your checkbox in a JTable here?
Rob Spoor

Joined: Oct 27, 2005
Posts: 19847

You'll probably also have to handle the mouse clicks on the check boxes manually.

How To Ask Questions How To Answer Questions
subject: Custom CheckBox