United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4681104 Programmatic state changes do not trigger events in AWT
JDK-4681104 : Programmatic state changes do not trigger events in AWT

Details
Type:
Bug
Submit Date:
2002-05-07
Status:
Closed
Updated Date:
2004-09-16
Project Name:
JDK
Resolved Date:
2003-09-05
Component:
docs
OS:
solaris_7,generic
Sub-Component:
guides
CPU:
sparc,generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.0-b57,1.4.1
Fixed Versions:
5.0 (tiger)

Related Reports
Relates:
Relates:

Sub Tasks

Description
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.

                                    

Comments
EVALUATION

Will fix in tiger.
###@###.### 2002-08-02

Fixed in tiger.  Reviewed by Brent, approved by CCC.
###@###.### 2003-08-14
                                     
2002-08-02
PUBLIC COMMENTS

.
                                     
2004-09-17
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b19

VERIFIED IN:
1.5


                                     
2004-09-17



Hardware and Software, Engineered to Work Together