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

Default Button does not gets clicked when enter key is pressed - jdk1.4

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs



      Name: bsC130419 Date: 07/12/2001


      jdk 1.4beta b65

      Compile the source file and hit the enter key. The default button is not
      getting clicked.

      import java.awt.event.*;
      import javax.swing.*;
      import java.awt.Container;
      import java.awt.*;


      public class TextFieldEditable extends JFrame
      {

       JButton submit,close,help;
       JTextField text1=null;

       public TextFieldEditable()
       {
         super ("Test");
         Container con=getContentPane();

         submit=new JButton("Submit");
         close=new JButton("Close");
         help=new JButton("Help");
         
         text1=new JTextField(10);
        
         JPanel buttonPanel=new JPanel();

         JPanel p=new JPanel();
         JPanel p1=new JPanel();
         JPanel p2=new JPanel();
         JPanel p3=new JPanel();


         p.add(text1);
         p1.add(submit);
         p2.add(close);
         p3.add(help);


         buttonPanel.setLayout(new GridLayout(3,1));
         buttonPanel.add(p1);
         buttonPanel.add(p2);
         buttonPanel.add(p3);
         
         con.add(buttonPanel,BorderLayout.WEST);
         con.add(p,BorderLayout.CENTER);
         
         getRootPane().setDefaultButton(submit);
         setSize(400,200);
         setVisible(true);
       }


        public static void main(String args[])
        {
           TextFieldEditable t=new TextFieldEditable();
        }

      }
      (Review ID: 127970)
      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: