-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4
-
1.1.6
-
x86
-
windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2017333 | 1.2.0 | Creighton Chong | P3 | Resolved | Fixed | 1.2beta3 |
Name: ggC50526 Date: 10/09/97
Oracle BugId: 560041
According to the documentation for Window.getFocusOwner(), it should return
the "child component of this Window which has focus if and only if this
Window is active." However, it always returns the child component the the
Window, regardless of whether the window is active or not.
To reproduce:
Compile and run the testcase using the appletviewer. It will bring up two
windows. Pressing the button in either window will tell you the focus owner
for the other window. It should return null since the other window will be
inactive, but it doesn't.
B560041.JAVA:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class b560041
extends Applet
implements ActionListener
{
Frame mFrame1;
Frame mFrame2;
TextField mTextField1;
TextField mTextField2;
Button mButton1;
Button mButton2;
public b560041()
{
}
public void start()
{
mFrame1 = new Frame();
mFrame1.setLayout(null);
mFrame1.setBounds(50, 50, 300, 300);
mFrame2 = new Frame();
mFrame2.setLayout(null);
mFrame2.setBounds(400, 50, 300, 300);
mTextField1 = new TextField("TextField1");
mTextField1.setBounds(50, 70, 100, 20);
mTextField2 = new TextField("TextField2");
mTextField2.setBounds(50, 70, 100, 20);
mButton1 = new Button("Button1");
mButton1.setBounds(220, 55, 49, 22);
mButton1.addActionListener(this);
mButton2 = new Button("Button2");
mButton2.setBounds(220, 55, 49, 22);
mButton2.addActionListener(this);
mFrame1.add(mTextField1);
mFrame1.add(mButton1);
mFrame1.show();
mFrame2.add(mTextField2);
mFrame2.add(mButton2);
mFrame2.show();
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == mButton1)
{
System.out.println("\n######## Button1 mTop pressed.");
System.out.println("%%% %%% Focus Owner for window2: " + mFrame2.getF
ocusOwner());
}
else if (e.getSource() == mButton2)
{
System.out.println("\n######## Button mButton2 pressed.");
System.out.println("%%% %%% Focus Owner for Window1: " + mFrame1.getF
ocusOwner());
}
}
}
B560041.HTML:
<APPLET code="b560041.class" width=10 height=10>
</APPLET>
======================================================================
- backported by
-
JDK-2017333 WINDOW.GETFOCUSOWNER DOESN'T RETURN NULL IF THE WINDOW IS INACTIVE
-
- Resolved
-