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

JTextfield does not generate ActionEvent after keyboard's Return is entered.

    XMLWordPrintable

Details

    • kestrel
    • generic, sparc
    • generic, solaris_2.6
    • Verified

    Description

      The JTextField doesn't generate the ActionEvent when run
      with jdk1.3. The following program works OK with jdk1.2fcs

      This bug caused a working JCK test, Swing's interactive
      JFileChooserTests's JFileChooserTest0006 and JFileChooserTest0007
      to fail so I'm marking is as a RED bug.

      Roger Pham 10/1/99
      --------------------------------------------------------------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class Jtf extends JFrame implements ActionListener {
          Jtf() {
              Container c = getContentPane();
              c.setLayout(new FlowLayout());

      JTextField tf = new JTextField("", 30);
      tf.addActionListener(this);
      c.add(new JLabel("Type something and hit Return"));
      c.add(tf);

      setSize(350,200);
      setVisible(true);
      c.validate();
          }

          public void actionPerformed(ActionEvent e) {
      JTextField tf = (JTextField) e.getSource();
      System.out.println(tf.getText());
          }

          public static void main(String argv[]) {
      Jtf f = new Jtf();
          }
      }
      --------------------------------------------------------------

      Attachments

        Issue Links

          Activity

            People

              tprinzing Tim Prinzing
              rphamsunw Roger Pham (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: