-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
generic
-
generic
Name: skT45625 Date: 06/16/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Below is the setEnabled() method from javax.swing.AbstractAction
---
public void setEnabled(boolean newValue) {
boolean oldValue = this.enabled;
this.enabled = newValue;
firePropertyChange("enabled",
new Boolean(oldValue), new Boolean(newValue));
}
There is no check to see if the old value is the same as the new value. If
this action is being set to the old value, then this is not a "propertyChange"
either. Each time something changes, this creates two Boolean objects. This
is a small thing, but when you have listeners (like table row listeners) doing
things with actions, this can add up quickly. This seems like an easy
optimization.
I don't know if there are any defined JavaBean sematics for firing these events
when there is not an actual value change, but it seems like (by the very name)
that it should not fire an even if the property has not changed.
(Review ID: 106243)
======================================================================