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

REGRESSION: JOptionPane.showConfirmDialog has wrong focus

    XMLWordPrintable

Details

    Description



      Name: gm110360 Date: 12/18/2001


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


      FULL OPERATING SYSTEM VERSION :
      Windows 98

      A DESCRIPTION OF THE PROBLEM :
      A component displayed in a JOptionPane Confirm Dialog
      that has the focus set with requestFocus() will not
      have the focus.

      Run the following code:
      --begin code--
      import javax.swing.*;
      import java.awt.*;

      class test{
        test(){
          run();
        }
        void run(){
          JDialog jd=new JDialog();
          jd.setTitle("test");
          jd.pack();
          jd.setSize(new Dimension(300,300));
          jd.show();
          JPanel jp=new JPanel();
          JTextField jtf=new JTextField("This field should have
      focus.");
          jp.add(jtf);
          jtf.requestFocus();
          JOptionPane.showConfirmDialog(jd,jp,"Focus
      Test",JOptionPane.OK_CANCEL_OPTION);
          System.exit(0);
        }
        public static void main(String[] args){
          test t=new test();
        }
      }
      --end code--

      When run with JRE 1.3.1 the JTextField has the focus. When
      run with 1.4beta3, it does not.

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the above code with merlin and then with 1.3.1

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The JTextField should have the focus.

      This bug can be reproduced always.

      Release Regression From : 1.3.1_01a
      The above release value was the last known release where this
      bug was knwon to work. Since then there has been a regression.

      (Review ID: 137476)
      ======================================================================

      Attachments

        Activity

          People

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: