Can anyone suggest a way that I can have JColorChooser's
showDialog appear initially in its RGB tab? (ie index 2)
For example, when the program below runs, it initially
displays the "Swatches" tab (ie index 0), but there doesn't
seem to be a way to get access to the underlying JTabbedPane
to call its setIndex method.
I tried looking at Sun's source to see if I could create
a subclass of JColorChooser, but I got lost in its
javax.swing.colorchooser package and never did figure out
where to get a ref to the JTabbedPane used by showDialog.
Is there a UI attribute that I can use to set the tab
index initially displayed? TIA,
import javax.swing.*;
class cc extends JFrame
{
public cc () throws Exception
{
Color c = JColorChooser.showDialog (this, ", null);
if (c != null)
{
System.out.println ("Red: " + c.getRed ());
System.out.println ("Green: " + c.getGreen ());
System.out.println ("Blue: " + c.getBlue ());
}
else
System.out.println ("you didn't pick a color!");
System.exit (0);
}
public static void main (String args[]) throws Exception
{
new cc ();
}
}
Tom Cole - 05 Jan 2004 02:30 GMT
Have you looked into:
getChooserPanels();
setChooserPanels(AbstractChooserPanels[]);
and
removeChooserPanel();
> Can anyone suggest a way that I can have JColorChooser's
> showDialog appear initially in its RGB tab? (ie index 2)
[quoted text clipped - 34 lines]
> }
> }