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

Enhancement management of the javax.swing.Action class

XMLWordPrintable

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



      Name: jk109818 Date: 01/28/2002


      FULL PRODUCT VERSION :
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Windows 98 [Version 4.10.1998]



      A DESCRIPTION OF THE PROBLEM :
      Management of several GUI component states is not
      centralized by the javax.swing.Action class. For example,
      there is no way to set the "selected state" of a
      JToggleButton, JRadioButton, or JCheckBoxMenuItem. Neither
      there is a method like action.setSelected(true), nor the
      putValue("selected", new Boolean(true)) works.
      Management of several states of GUI components could be
      considered: "selected", "selected index"

      I am looking for a method like setSelected(boolean) in
      javax.swing.Action interface.
      For example, look at the following code:

      --------------------------------------------------------
      Action a = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
         //doing work
        }
      };

      JToggleButton b1 = new JToggleButton(a);
      JCheckBoxMenuItem m1 = new JCheckBoxMenuItem(a);
      --------------------------------------------------------

      The "seleted" state of b1 and m1 should be equivalent because they are
      referring to the
      same action. Currently it is not impossible to set the "selected" state of
      both b1 and m1
      from the Action object's method, neither a.setSelected(boolean) nor
      a.putValue("selected", new Boolean(boolean)), instead I have to access both
      b1 and m1
      and set their "selected" state one by one, i.e. b1.setSelected(boolean) and
      m1.setSelected(boolean).

      I suggest to add a setSelected(boolean) method in the javax.swing.Action
      interface such that we
      could centrally change the "selected" state of components that share the
      same Action object.

      This bug can be reproduced always.
      (Review ID: 138554)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: