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

Focus lost in Textfield after doing a back/forward from Internet Explorer using

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b02
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      Using the following file(s):

         appletTextFieldCursor.html (note: 'legacy_lifecycle=true')
         TextFieldCursor.java

      On Windows 2000, run the testcase with the jre 1.4.2_07 plugin via IE. 1)Launch IE where a webpage (www.javasoft.com) is displayed.
      2)Then open the appletTextFieldCursor.html by using File->Open.
      3)When the testcase appears you'll see a Form with a single non-navigable JButton() and a JTextField() with "555" highlighted. 4)Now, use the IE browsers back button and forward button until you see the JTextField() looses focus. We have found that this testcase does not reproduce on Windows XP.

      JDK/JRE tested with:
         1.4.2_07/08/09
         1.5.2_04


      <html>
      <head>
        <title>TextFieldCursor (Oracle)</title>
      </head>
      <body>
      <object classid="clsid:CAFEEFAC-0014-0002-0008-ABCDEFFEDCBA"
              WIDTH="400" HEIGHT="300">
      <param name="TYPE" value="application/x-java-applet;jpi-version=1.4.2_08">
      <param name="IE" value="native" >
      <param name="legacy_lifecycle" value="true" >
      <param name="CODE" value="TextFieldCursor" >
      </object>
      </body>
      </html>



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

      import javax.swing.*;

      public class TextFieldCursor extends JApplet
                                   implements ComponentListener,
                                              ActionListener
      {

          JTextField textField;
          JTextArea textArea;
          JButton jButton;

          private boolean mFocusRequestedForApplet = false;

          public void init()
          {
              textField = new JTextField();
              textField.addActionListener(this);
              jButton = new JButton();

              getContentPane().setLayout(null);
              textField.setText("555");
              textField.setBounds(new Rectangle(100, 40, 150, 30));
              textField.setFont(new Font("Arial", 0, 16));

              jButton.setText("Button");
              jButton.setRequestFocusEnabled(false);
              jButton.setBounds(new Rectangle(130, 75, 90, 30));
              jButton.setToolTipText("");
              getContentPane().add(jButton, null);
              getContentPane().add(textField, null);

              getContentPane().setVisible(true);
              setVisible(true);

              textField.requestFocus();
              textField.selectAll();
          }


          public void actionPerformed(ActionEvent evt)
          {

          }


          public void start()
          {
              addComponentListener(this);
          }


          /**
          ** Stops the Applet.
          **
          ** @see java.applet.Applet
          */
          public void stop()
          {
              removeComponentListener(this);
              mFocusRequestedForApplet = false;
          }


          //------------------------------------------------------------------------
          // ComponentListener Interface
          //------------------------------------------------------------------------
          public void componentResized(ComponentEvent e)
          {

          }


          public void componentMoved(ComponentEvent e)
          {

          }


          public void componentShown(ComponentEvent e)
          {
              textField.requestFocus();
              textField.selectAll();
              mFocusRequestedForApplet = true;
          }


          public void componentHidden(ComponentEvent e)
          {

          }


          public void requestFocus()
          {
              if ( !mFocusRequestedForApplet )
              {
                  super.requestFocus();
              }
          }

      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kbalasubsunw Kannan Balasubramanian (Inactive)
              Reporter:
              mmma Marvin Ma (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: