I am in the process of translating a python/Qt GUI application into Java/Swing. The original application beautifully updates the scene color continuously as the user drags the sliders in a QColorDialog. How can I get a similar effect in a JColorChooser? All the examples I have found update the color only when the user clicks the "Apply" or "OK" button. Is there a mechanism for listening to continuous color changes in a JColorChooser as my user drags, say, the "Red" slider?
// How can I listen to every color adjustment?
// (i.e. not just when the user presses "Apply" or "OK"?)
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
System.out.println("color changed");
}
};
Dialog colorDialog = JColorChooser.createDialog(ColorChannelWidget.this,
"Select color for channel 3",
false, // not modal
new JColorChooser(Color.pink),
actionListener, actionListener);
colorDialog.setVisible(true);
Edit:
The colors I will be changing are in a dynamically generated OpenGL scene. Not, say, a static image.