import java.awt.Color; import javax.swing.JColorChooser; public class Main { public static void main(String[] argv) { JColorChooser chooser = new JColorChooser(); // Set the selected color chooser.setColor(Color.red); // Get current selected color Color color = chooser.getColor(); } }