Java tutorial
import java.awt.Color; import javax.swing.JColorChooser; public class Main { public static void main(String[] args) { // Display a color chooser dialog Color color = JColorChooser.showDialog(null, "Select a color", null); // Check if user selected a color if (color == null) { System.out.println("we cancelled or closed the color chooser"); } else { System.out.println("we selected color: " + color); } } }