aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Custom CheckBox" Watch "Custom CheckBox" New topic
Author

Custom CheckBox

seema chhetri
Ranch Hand

Joined: Feb 17, 2009
Posts: 42
Hello,

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,
Seema
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

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.
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#display


[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?

http://www.coderanch.com/t/431744/Swing-AWT-SWT-JFace/java/checkbox
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Custom CheckBox