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

Enter key doesn't fire List actionPerformed as specified (win32 ONLY)

XMLWordPrintable

    • x86
    • windows_95, windows_nt



      Name: rm29839 Date: 10/29/97


      The JDK documentation for java.awt.List states
      that the "AWT also generates an action event when
      the user presses the return key while an item in
      the list is selected." In Windows 95 and Windows NT
      it doesn't. (In OS/2 it does.)


      The JDK documentation for java.awt.List states
      that the "AWT also generates an action event when
      the user presses the return key while an item in
      the list is selected." In Windows 95 and Windows NT
      it doesn't. (In OS/2 it does.)

      ***********************************************
      import java.awt.*;
      import java.awt.event.*;

      class ListAction extends Frame {
         /* Demonstrates that no action event is produced
            when <Enter> is pressed. */
         static long currentMillis = System.currentTimeMillis();
         static Runtime rt = Runtime.getRuntime();

         public static void main(String[] args) {
            new ListAction();
         }

         ListAction() {
            super("ListAction Test Frame");

            setSize(300,300);

            Panel pnl1 = new Panel();
            add(pnl1);
            pnl1.setLayout(new BorderLayout());

            List list = new List();
            for(int i=0; i < 5; i++) {
               list.addItem("Item " + i);
            }
            pnl1.add(list);

            list.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent ev) {
                  System.out.println("actionPerformed");
               }
            });

            list.addItemListener(new ItemListener() {
               public void itemStateChanged(ItemEvent ev) {
                  System.out.println("itemStateChanged");
               }
            });

            setVisible(true);
         }
      }
      (Review ID: 14631)
      ======================================================================

            kdmsunw Kdm Kdm (Inactive)
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: