Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4681104

Programmatic state changes do not trigger events in AWT

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 5.0
    • 1.0-b57, 1.4.1
    • docs
    • tiger
    • generic, sparc
    • generic, solaris_7
    • Verified

      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.

            sharonz Sharon Zakhour (Inactive)
            bchristi Brent Christian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: