JDK-4351446 : requestFocus() does not work on Windows NT
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-07-07
  • Updated: 2001-01-11
  • Resolved: 2001-01-11
Related Reports
Duplicate :  
Description

Name: skT45625			Date: 07/07/2000


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)


Compile and run the program shown below. On Solaris, the window comes up with
the focus on the second text field; on Windows NT (4.0sp5), the focus is on the
first.

I have seen several similar-looking bugs to this one, but they all seem to be
very old or closed. This problem still occurs in JDK 1.3 final.


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

class TestFocus extends JFrame
{
        JTextField t1;
        JTextField t2;
        JTextField t3;

        TestFocus()
        {
                getContentPane().setLayout(new FlowLayout());
                t1 = new JTextField("t1");
                t2 = new JTextField("t2");
                t3 = new JTextField("t3");

                getContentPane().add(t1);
                getContentPane().add(t2);
                getContentPane().add(t3);
                pack();
                addWindowListener(new WindowAdapter() {
                    public void windowActivated(WindowEvent e) {
                        t2.requestFocus();
                    }
                });
                setVisible(true);
        }

        public static void main(String [] args)
        {
                new TestFocus();
        }
}
(Review ID: 106971) 
======================================================================

Comments
WORK AROUND Name: skT45625 Date: 07/07/2000 None known. ======================================================================
11-06-2004

EVALUATION This is fixed as a result of the merlin focus enhancements. Closing as dup of that bugid (4290675). hania.gajewska@Eng 2001-01-10
10-01-2001