I want to set my myColorItem
menu item to the color a user selects from my JColorChooser
. I tried this but apparently i can not cast a color to an ImageIcon
.
myColorItem = new JMenuItem("Color...");
myColorItem.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent theEvent) {
Color color = JColorChooser.showDialog(null, "", myDefaultColor);
// This is what is not working
myColorItem.setIcon(new ImageIcon(color));
}
});
Thanks for any feedback