Java tutorial
import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JColorChooser; import javax.swing.JDialog; public class CreateColorSamplePopup { public static void main(String args[]) { final JColorChooser colorChooser = new JColorChooser(Color.RED); ActionListener okActionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println("Color change rejected"); } }; // For cancel selection, change button background to red ActionListener cancelActionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println("cancled"); } }; final JDialog dialog = JColorChooser.createDialog(null, "Change Button Background", true, colorChooser, okActionListener, cancelActionListener); dialog.setVisible(true); } }