> I'm looking for a Swing "3-state checkbox". In this particular case the
> three states are "unknown", "yes", and "no" ...

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
>> I'm looking for a Swing "3-state checkbox". In this particular case
>> the three states are "unknown", "yes", and "no" ...
>
><sscce>
[snip]
Thanks, but I'm really looking for a single control. It needs to be placed
in a JTable (well, actually, several of them will get placed in a single
JTable) and "real estate" is an issue.
Chas Douglass
Andrei Kouznetsov - 28 Dec 2004 22:09 GMT
>>> I'm looking for a Swing "3-state checkbox". In this particular case
>>> the three states are "unknown", "yes", and "no" ...
[quoted text clipped - 5 lines]
> in a JTable (well, actually, several of them will get placed in a single
> JTable) and "real estate" is an issue.
why you don't want to use simple JComboBox with 3 entries?

Signature
Andrey Kuznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Chas Douglass - 28 Dec 2004 23:42 GMT
>>>> I'm looking for a Swing "3-state checkbox". In this particular
>>>> case the three states are "unknown", "yes", and "no" ...
[quoted text clipped - 7 lines]
>
> why you don't want to use simple JComboBox with 3 entries?
Strictly aesthetics. I think a 3-state checkbox (again, similar to what
I've seen in Windows property sheets, which can be checked, unchecked, or
"sort of grayed" (but not disabled) which means "inherited").
I'm sorry I can't remember exactly where I've seen that -- I thought it was
a fairly common UI pattern.
Chas Douglass
Andrei Kouznetsov - 29 Dec 2004 00:58 GMT
>>>>> I'm looking for a Swing "3-state checkbox". In this particular
>>>>> case the three states are "unknown", "yes", and "no" ...
[quoted text clipped - 15 lines]
> was
> a fairly common UI pattern.
try this link: http://www.javaspecialists.co.za/archive/Issue082.html

Signature
Andrey Kuznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Chas Douglass - 29 Dec 2004 20:41 GMT
> try this link: http://www.javaspecialists.co.za/archive/Issue082.html
Thanks, I'll give this a try. I appreciate the response.
Chas Douglass
Andrew Thompson - 29 Dec 2004 13:57 GMT
> .."real estate" is an issue.
Well, fussy, fussy! OK, try this..
<sscce>
import java.awt.*;
import javax.swing.*;
/** Demonstrates a three state checkbox, that's small. */
class ThreeStateCheckbox {
public static void main(String args[]) {
JFrame f = new JFrame("Three State Checkbox");
Container c = f.getContentPane();
c.setLayout(new GridLayout(1,0));
ButtonGroup bg = new ButtonGroup();
JCheckBox yes = new JCheckBox("Y");
yes.setToolTipText("Yes, for sure, feel free..");
bg.add( yes );
c.add( yes );
JCheckBox no = new JCheckBox("N");
no.setToolTipText("No way Jose!");
bg.add( no );
c.add( no );
JCheckBox unknown = new JCheckBox("?", true);
unknown.setToolTipText("Don't ask me, I just work here..");
bg.add( unknown );
c.add( unknown );
f.pack();
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
f.setVisible(true);
}
}
</sscce>
Of course, that'll 'cost' you double. ;-)

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Chas Douglass - 29 Dec 2004 20:42 GMT
>> .."real estate" is an issue.
>
[quoted text clipped - 38 lines]
>
> Of course, that'll 'cost' you double. ;-)
Thanks for the effort, Andrew, but it's still not quite what I was hoping
to find.
I appreciate it though, it is a good backup plan.
Chas Douglass