I want to implement Change Listener in the Action Listener of a Button
I have a color graph chooser and 2 buttons...Apply and Cancel
to select the color of the color chooser i have implemented the Change Listener
but I want the change listener to act on the Apply button click...
Since the listener which I have written is not in the apply button it takes place even when I click on cancel button....
code for change listener
final JColorChooser ColorChooser = new JColorChooser(Color.black);
public void stateChanged(ChangeEvent e)
newColor = ColorChooser.getColor();
code for action listener
public class ButtonHandler implements ActionListener
public void actionPerformed(ActionEvent ae)
Object button =ae.getSource();
8 Months Ago
Related Article:how to make radio buttons to change font
is a solved Java discussion thread by doctorjo5 that has 6 replies, was last updated 2 years ago and has been tagged with the keywords: beginner, buttons, java.