-
Bug
-
Resolution: Duplicate
-
P3
-
7
-
generic
-
generic
This behavior is reproducable with Linux and Solaris platforms.
I've a Frame having a button, visible on screen. On clicking the button, a Window (whose owner is the Frame) is shown and on clicking a button on Window, a Dialog is shown. Now, I dispose the Dialog. I expect focus to return to the button on the Window.
With jdk 7 (b06): Focus does not reach any of the components, and KeyboardFocusManager.getFocusOwner returns null.
With mustang: Focus reaches the button on the Window when Dialog is disposed
On Windows: Focus reaches the button on the Window when Dialog is disposed
I click a button (B) on the Window to close the Window. Now, the Frame is the only window shown on screen.
With jdk 6 & 7: Focus does not reach any of the components, but KeyboardFocusManager.getFocusOwner returns B even though B is no longer visible.
On Windows: When Window is closed, focus reaches the button on the Frame.
To reproduce the behavior, run the code below and click the 'Open Window' button on Frame
import java.awt.*;
import java.awt.event.*;
public class TopLevelFocusTest {
private static Frame f;
private static Window w;
private static Dialog d;
public static void main(String[] args) {
f = new Frame("Frame");
w = new Window(f);
w.setSize(200, 200);
w.setLocation(250, 0);
d = new Dialog(f);
d.setSize(200, 200);
d.setLocation(0, 250);
d.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
d.dispose();
}
});
d.setLayout(new FlowLayout());
d.add(new Button("Button1"));
d.add(new Button("Button2"));
Button bw1 = new Button("Open Dialog");
bw1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
d.setVisible(true);
}
});
Button bw2 = new Button("Close Window");
bw2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
w.dispose();
}
});
w.setLayout(new FlowLayout());
w.add(bw1);
w.add(bw2);
f.setSize(200, 200);
Button fb = new Button("Open Window");
fb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
w.setVisible(true);
}
});
f.setLayout(new FlowLayout());
f.add(fb);
f.add(new Button("Dummy Button"));
f.setVisible(true);
}
}
I've a Frame having a button, visible on screen. On clicking the button, a Window (whose owner is the Frame) is shown and on clicking a button on Window, a Dialog is shown. Now, I dispose the Dialog. I expect focus to return to the button on the Window.
With jdk 7 (b06): Focus does not reach any of the components, and KeyboardFocusManager.getFocusOwner returns null.
With mustang: Focus reaches the button on the Window when Dialog is disposed
On Windows: Focus reaches the button on the Window when Dialog is disposed
I click a button (B) on the Window to close the Window. Now, the Frame is the only window shown on screen.
With jdk 6 & 7: Focus does not reach any of the components, but KeyboardFocusManager.getFocusOwner returns B even though B is no longer visible.
On Windows: When Window is closed, focus reaches the button on the Frame.
To reproduce the behavior, run the code below and click the 'Open Window' button on Frame
import java.awt.*;
import java.awt.event.*;
public class TopLevelFocusTest {
private static Frame f;
private static Window w;
private static Dialog d;
public static void main(String[] args) {
f = new Frame("Frame");
w = new Window(f);
w.setSize(200, 200);
w.setLocation(250, 0);
d = new Dialog(f);
d.setSize(200, 200);
d.setLocation(0, 250);
d.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
d.dispose();
}
});
d.setLayout(new FlowLayout());
d.add(new Button("Button1"));
d.add(new Button("Button2"));
Button bw1 = new Button("Open Dialog");
bw1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
d.setVisible(true);
}
});
Button bw2 = new Button("Close Window");
bw2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
w.dispose();
}
});
w.setLayout(new FlowLayout());
w.add(bw1);
w.add(bw2);
f.setSize(200, 200);
Button fb = new Button("Open Window");
fb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
w.setVisible(true);
}
});
f.setLayout(new FlowLayout());
f.add(fb);
f.add(new Button("Dummy Button"));
f.setVisible(true);
}
}
- duplicates
-
JDK-6457980 regtest fails: java/awt/Focus/DisposedWindow/DisposedWindow.java
-
- Closed
-