Java examples for Swing:JColorChooser
Getting and Setting the Selected Color in a JColorChooser Dialog
import java.awt.Color; import javax.swing.JColorChooser; public class Main { public static void main(String[] argv) { // Create the chooser JColorChooser chooser = new JColorChooser(); // Set the selected color chooser.setColor(Color.red);//from w ww. j a va 2s . c o m // Create and show dialog. // See Creating a JColorChooser Dialog. // Get current selected color Color color = chooser.getColor(); } }