JColorChooser – Picking Color

This example has two buttons and a JTextArea. The user can click the Change Background and Change Foreground JButtons to set the background and text color for the text area. These two buttons will display a Java SDK built-in dialog so that user can pick the color from it.