-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.5.1
Name: aaC67449 Date: 11/30/98
JColorChooser.setColor(...) does not notify its PropertyChangeListeners when changing color, but should.
javadoc says:"
public void setColor(Color color)
Sets the current color of the color chooser to the specified color. This will fire a PropertyChangeEvent for the property named "color".
Parameters:
color - the color to be set in the color chooser
See Also:
JComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
"
see example:
-------------- Example ------------
import java.beans.*;
import java.awt.*;
import javax.swing.*;
public class Test extends JApplet{
public static void main(String argv[]) {
Color test = new Color(11,12,13);
JColorChooser c= new JColorChooser();
MyPCL lsnr = new MyPCL(); // create property change listener
c.addPropertyChangeListener(lsnr);
c.setColor(test); // set new color
if(!lsnr.isNotified()) { // test the listener is notified
System.out.println("FAILED.");
} else {
System.out.println("PASSED!");
}
}
}
class MyPCL implements PropertyChangeListener {
boolean notified=false;
public void propertyChange(PropertyChangeEvent evt) {
notified=true;
}
public boolean isNotified() {
boolean ret=notified;
notified=false;
return ret;
}
}
--------------- output----------
FAILED.
======================================================================
- duplicates
-
JDK-4166031 JColorChooser Docs for Set Color are wrong
-
- Resolved
-