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

CheckboxMenuItem doesn't generate action events

XMLWordPrintable

    • generic, sparc
    • solaris_2.4, solaris_2.5.1, solaris_2.6

      CheckboxMenuItem objects don't appear to generate action events,
      which they should since MenuItems do.

      ------------------------
      [Sheri Good 03/04/97]
      Another report of this bug, an example has been provided:


      Synopsis: CheckboxMenuItem does not generate an ActionEvent
      Severity Impact: (internal)
      Severity Functionality: (internal)
      Priority: (internal)
      Description: CheckboxMenuItem doesn't generate ActionEvents. Simple program
      follows that demonstrates.

      import java.awt.CheckboxMenuItem;
      import java.awt.Frame;
      import java.awt.Menu;
      import java.awt.MenuBar;
      import java.awt.MenuItem;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      public class TestCheckboxMenu extends Frame implements ActionListener
      {
      MenuItem cMenuItem;
      CheckboxMenuItem cCheckboxItem;

      public static void main (String[] asArg)
      {
      new TestCheckboxMenu ();
      }

      public TestCheckboxMenu ()
      {
      super ("TestCheckboxMenu");
      constructMenuBar();
      setSize (200,200);
      show();
      }

      private void constructMenuBar ()
      {
      MenuBar cMenuBar = new MenuBar ();
      Menu cTestMenu = new Menu ("Test");
      cTestMenu.add (cMenuItem = new MenuItem ("Normal menu item"));
      cMenuItem.addActionListener (this);
      cTestMenu.add (cCheckboxItem = new CheckboxMenuItem ("Checkbox menu item"));
      cCheckboxItem.addActionListener (this);
      cMenuBar.add (cTestMenu);
      setMenuBar (cMenuBar);
      }

      public void actionPerformed (ActionEvent cEvent)
      {
      if (cEvent.getSource() == cMenuItem)
      System.out.println ("Normal menu item selected");
      else if (cEvent.getSource() == cCheckboxItem)
      System.out.println ("Checkbox menu item selected");
      }
      }

      company - Raptor Systems Inc. , email - ###@###.###
      Work around:

      Comments:
      customer_rec: new
      Company: other
      Employee:Cleveland Brown
      Release: jdk11
      Hardware Version: i586
      O/S version: win_nt_4.0
      User Role: D
      User Type: E
      Sun Contact: (internal)
      end_customer_rec:
      BUG_END

            bchristi Brent Christian
            kwalrathsunw Kathy Walrath (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: