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

javax.swing.Timer doesn't allow to set actionCommand in posted events.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 1.4.2
    • client-libs
    • beta
    • x86
    • windows_98

      Name: rmT116609 Date: 04/15/2004


      A DESCRIPTION OF THE REQUEST :
      When javax.swing.Timer fires an ActionEvent it sets its actionCommand to null. There is no way to change the value of and actionCommand during the life of an ActionEvent. I think it would be good to have the following constructor:
      Timer(int delay, ActionListener listener, String actionCommand)
      which will allow to set an actionCommand value of the ActionEvents fired by the Timer.

      JUSTIFICATION :
      1. An actionCommand is a property of ActionEvent and there should be a possibility to set this property when the event objects are generated by the Timer.
      2. An actionCommand can be used to easily distinguish between event sources.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Implement the constructor:
      Timer(int delay, ActionListener listener, String actionCommand)
      and
      public void setActionCommand(StringM-^OÀ»actionCommand)
      method in the Timer class.

      CUSTOMER SUBMITTED WORKAROUND :
      Subclass the Timer, add some actionCommandLike property. In the actionPerformed check if the runtime class of the event source is your Timer-subclass, than cast and get the value of the property.
      (Incident Review ID: 209280)
      ======================================================================
      ###@###.### 10/12/04 18:20 GMT

            shickeysunw Shannon Hickey (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: