-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
x86
-
windows_nt
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)
======================================================================
- duplicates
-
JDK-4290675 Focus Management Enhancements
-
- Closed
-