+4  A: 

Here is an example for a TristateCheckBox:

http://www.javaspecialists.co.za/archive/Issue145.html

Example showing TristateCheckBox

Peter Lang
@Peter Two questions: First, I didn't find any link for the jar file of TristateCheckBox on the site you told me. Will I need to make the jar (or classes) manually, from the code mentioned on the site? Second, there is very little difference in the appearance of selected and intermediate state of the checkbox which a normal end-user can't figure out quickly. Is there any way by which I can modify it to the one I displayed in my question. WinXp uses the same intemediate appearance that I showed in my question.
Yatendra Goel
@Yatendra Goel: There is no jar-File, you will have to use the files yourself (or build your own jar). Since JCheckBox does not know of this third state, the status `pressed` has been used in this example to render the third state, so I'm afraid there is no easy way to change the graphical representation to match the standard XP-style.
Peter Lang
+4  A: 

Oh yes, but you have to create a custom component.

Take a look at this article in the Java Specialist and see if it works for you.

It needs a bit of work in OSX though.

alt text

WinXP:

alt text

OscarRyz
@Oscar Reyes: The link in my answer contains the `revised version of this newsletter that works for Java 5 upwards` :)
Peter Lang
@Peter: +1 Great, I wasn't aware of that version. Do you happen to have Windows at hand? I wonder how that look like?
OscarRyz
@Oscar Reyes: Yes, I do have - updated my answer (+1 for you too)
Peter Lang
+2  A: 

If you're trying to do a tree of checkboxes (which is a common reason to need a tri state checkbox), check out Jide Commons.

alt text

I82Much
+1 Jide is my favorite framework
OscarRyz
Yes, I want a tree of checkboxes. I searched the site you mentioned but didn't find the page demonstrating the tree. Second, I want to use it in my commercial development so Is is free or Do I need to purchase a license?
Yatendra Goel
You can download the demo (http://www.jidesoft.com/products/1.4/jide_demo.jnlp) and see if it has an example with the CheckboxTree (it probably does). As far as the licensing issue, it's released under the GPL.
I82Much
A: 

Later I found a ready-made solution at http://www.ansir.ca/tristate.jsp

Yatendra Goel