public static Color showDialog1(Component component, String title,
Color initialColor) throws HeadlessException {
AbstractColorChooserPanel[] oldPanels;
JColorChooser pane = new JColorChooser(
initialColor != null ? initialColor : Color.white);
oldPanels = pane.getChooserPanels();
for (int i = 0; i < oldPanels.length; i++) {
String clsName = oldPanels[i].getClass().getName();
if (clsName
.equals("javax.swing.colorchooser.DefaultRGBChooserPanel")) {
// Remove rgb chooser if desired
pane.removeChooserPanel(oldPanels[i]);
} else if (clsName
.equals("javax.swing.colorchooser.DefaultHSBChooserPanel")) {
// Remove hsb chooser if desired
pane.removeChooserPanel(oldPanels[i]);
}
}
pane.setPreviewPanel(new JPanel());
ColorTracker ok = new ColorTracker(pane);
JDialog dialog = createDialog(component, title, true, pane, ok,
null);
dialog.setVisible(true);