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

Action processing in Swing

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: rk38400 Date: 05/13/98


      Action processing in Swing is only half done:

      1. Only JButtons may be added to a JToolbar.
         Can't associate a JToggleButton or other types.
      2. Only JMenuItems may be added to JMenu
         Can't associate a JCheckBoxMenuItem or JRadioaButtonMenuItem
      3. The current method of using an Action to create the component
      limits the type of components that can be associated with the Action.
      4. The same code is replicated in several places (re property change)

      Suggestions:
      1. Generalize (Move) action handling to AbstarctButton (or possibly JComponent).
      2. Add a checked property to Action to enable control of JToggleButton,JCheckBoxMenuItem
      etc. (or add CheckedAction as a subclass of Action).
      3. Allow asociation of an Action with an existing button/component: AbstractButton.setAction().
      This would setup the appropriate property change listeners etc (as now with JToolBar.add(Action))).

      Actions are a nice idea but are not fully implemented. I'm sure these particular suggestions are flawed,
      but they indicate the need for a more general solution.
      (Review ID: 30286)
      ======================================================================

            gsaab Georges Saab
            rkarsunw Ralph Kar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: