JDK-4681104 : Programmatic state changes do not trigger events in AWT
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: docs
  • Sub-Component: guides
  • Priority: P2
  • Affected Version: 1.0-b57,1.4.1
  • OS: generic,solaris_7
  • CPU: generic,sparc
  • Submit Date: 2002-05-07
  • Updated Date: 2017-05-16
  • Resolved Date: 2003-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
5.0 tigerFixed
Related Reports
Relates :  
Relates :  
This bug is filed in response to:

4680670 : Adjustable.setValue() does not notify AdjustmentListener

The short answer to this can be found in "The Java Class Libraries Second Edition, Volume 2" in the setValue() documentation for Scrollbar:

"Calling setValue() does not fire an AdjustmentEvent."

For some reason, though, this passage does not appear in the JavaDoc for java.awt.Scrollbar, resulting in the following:

4195694 : Scrollbar.set{Value,Values()} fails to generate an AdjustmentEvent
4193532 : Java v1.1.6 Scrollbar generates recursive event loop
4040860 : AdjustmentEvent not delivered when scrollbar's value is changed programmatically (1997!)
4680670 : Adjustable.setValue() does not notify AdjustmentListener

We went through a similar stream of bugs with Checkbox and List:

4324396 : AWT Checkbox and CheckboxMenuItem's setState() will not trigger an ItemEvent
4067113 : ItemListener not fired when using methods to select/deselect
4034837 : Checkbox.setState() does not notify listeners
4032466 : item events not generated when state programmaticaly set on Checkbox/List

with the final resolution:

4318851 : ItemEvent not triggered List,Choice,CheckBox,CheckboxMenuItem

which has a fairly robust description of the situation for ItemEvents.

The same goes for Scrollbar and AdjustmentEvents, and any Component which sends state change events when a user interacts with it, but can also have its state modified programmatically.  Programmatic state changes do not trigger events.  This message needs to be in all applicable Components, and hopefully that will prevent future misunderstandings and bugs from being filed.

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b19 VERIFIED IN: 1.5


EVALUATION Will fix in tiger. ###@###.### 2002-08-02 Fixed in tiger. Reviewed by Brent, approved by CCC. ###@###.### 2003-08-14