Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JColorChooser: hide all default panels and show HSB panel only

How can I hide all default panels at JColorChooser except HSB?

And is it possible to show just HSB without JTabbedPane, just plain panel

enter image description here

Thank you!

like image 413
VextoR Avatar asked Dec 16 '22 04:12

VextoR


1 Answers

import javax.swing.*;
import javax.swing.colorchooser.*;

class ColorChooserTest {

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JColorChooser cc = new JColorChooser();
                AbstractColorChooserPanel[] panels = cc.getChooserPanels();
                for (AbstractColorChooserPanel accp : panels) {
                    if (accp.getDisplayName().equals("HSB")) {
                        JOptionPane.showMessageDialog(null, accp);
                    }
                }
            }
        });
    }
}
like image 138
Andrew Thompson Avatar answered Apr 02 '23 19:04

Andrew Thompson