Java JColorChooser

The JColorChooser class is used to create a color chooser dialog box so that user can select any color. It inherits JComponent class.

JColorChooser class declaration

Let's see the declaration for javax.swing.JColorChooser class.

public class JColorChooser extends JComponent implements Accessible

Commonly used Constructors:

Constructor Description
JColorChooser() It is used to create a color chooser panel with white color initially.
JColorChooser(color initialcolor) It is used to create a color chooser panel with the specified color initially.

Commonly used Methods:

Method Description
void addChooserPanel(AbstractColorChooserPanel panel) It is used to add a color chooser panel to the color chooser.
static Color showDialog(Component c, String title, Color initialColor) It is used to show the color chooser dialog box.

Java JColorChooser Example

Flash Soon


Output


Java JColorChooser Example with ActionListener

Flash Soon


Output


Advertisement

Copyright ©2017 Design& develop