I am creating small application where user will select color by pressing button. I would like to when user selects the color from JColorChooser
dialog and setup the color of application as background also to put name of the color in jLabel
.
So far I have create following code:
private void btnChooseColorActionPerformed(java.awt.event.ActionEvent evt) {
Color color = JColorChooser.showDialog(getContentPane(), "Choose color", Color.yellow);
this.getContentPane().setBackground(color);
lblColorSelected.setText("Color: " + /* here I would like to append code that will display name of the color what user have selected */);
}
I have successfully created that user selects the color from dialog and color goes on application as background but only problem is that I don't know how to get the name of the colors selected by the user. Do you have any idea?