-
Bug
-
Resolution: Unresolved
-
P3
-
7, 8, 11, 12, 13, 14, 15, 16
-
Cause Known
-
x86
-
solaris
This is reproducible with jdk7 on OpenSolaris x86 system. Not reproducible with 6u12.
I'm showing an application modal excluded frame and an application modal dialog. Component present in a dialog whose parent is the frame do not gain focus even when clicked.
To reproduce, run the below code:
It shows a Frame which is application modal excluded. On clicking 'Open Modal Dialog', an application modal dialog opens. On clicking a button on the application modal dialog, a Window and Dialog are opened, both using Frame as parent. When they come up, it could be seen that focus is nowhere. Click the button on the Window. It should gain focus. Click the button on the Dialog. If the component on the child dialog do not gain focus, bug is reproduced. It does not gain focus even when it is clicked.
import java.awt.*;
import java.awt.event.*;
public class ModalityTest {
public static void main(String[] args) {
Frame f = new Frame();
final Dialog xd = new Dialog(f);
final Window xw = new Window(f);
final Dialog md = new Dialog(f);
md.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
md.setLocation(250, 0);
md.setSize(200, 200);
md.setLayout(new FlowLayout());
Button mdb = new Button("Open Child Dialog");
mdb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
xd.setVisible(true);
xw.setVisible(true);
}
});
md.add(mdb);
f.setLayout(new FlowLayout());
f.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
f.setSize(200, 200);
Button fb = new Button("Open Modal Dialog");
fb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
md.setVisible(true);
}
});
f.add(fb);
xd.setLocation(0, 250);
xd.setSize(200, 200);
xd.setLayout(new FlowLayout());
xd.add(new Button("Click Me"));
xw.setLocation(250, 250);
xw.setSize(200, 200);
xw.setLayout(new FlowLayout());
xw.add(new Button("Click Me"));
f.setVisible(true);
}
}
I'm showing an application modal excluded frame and an application modal dialog. Component present in a dialog whose parent is the frame do not gain focus even when clicked.
To reproduce, run the below code:
It shows a Frame which is application modal excluded. On clicking 'Open Modal Dialog', an application modal dialog opens. On clicking a button on the application modal dialog, a Window and Dialog are opened, both using Frame as parent. When they come up, it could be seen that focus is nowhere. Click the button on the Window. It should gain focus. Click the button on the Dialog. If the component on the child dialog do not gain focus, bug is reproduced. It does not gain focus even when it is clicked.
import java.awt.*;
import java.awt.event.*;
public class ModalityTest {
public static void main(String[] args) {
Frame f = new Frame();
final Dialog xd = new Dialog(f);
final Window xw = new Window(f);
final Dialog md = new Dialog(f);
md.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
md.setLocation(250, 0);
md.setSize(200, 200);
md.setLayout(new FlowLayout());
Button mdb = new Button("Open Child Dialog");
mdb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
xd.setVisible(true);
xw.setVisible(true);
}
});
md.add(mdb);
f.setLayout(new FlowLayout());
f.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
f.setSize(200, 200);
Button fb = new Button("Open Modal Dialog");
fb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
md.setVisible(true);
}
});
f.add(fb);
xd.setLocation(0, 250);
xd.setSize(200, 200);
xd.setLayout(new FlowLayout());
xd.add(new Button("Click Me"));
xw.setLocation(250, 250);
xw.setSize(200, 200);
xw.setLayout(new FlowLayout());
xw.add(new Button("Click Me"));
f.setVisible(true);
}
}