Getting and Setting the Selected Color in a JColorChooser Dialog
import java.awt.Color;
import javax.swing.JColorChooser;
publicclass Main {
publicstaticvoid main(String[] argv) {
JColorChooser chooser = new JColorChooser();
// Set the selected color
chooser.setColor(Color.red);
// Get current selected color
Color color = chooser.getColor();
}
}