-
Enhancement
-
Resolution: Fixed
-
P4
-
1.3.1, 1.4.2
-
b38
-
x86
-
windows_2000
-
Verified
Name: gm110360 Date: 12/13/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
There are many bugs which touch upon this issue (modal dialog and non-modal
window behavior), but I couldn't find one with this spin:
I have an application that needs to bring up warnings in response to server-
generated (i.e. not user-generated) events. If there is a modal dialog up when
I need to bring the new window, there's no way to bring it up behind the modal
dialog. show() forces it to the front. Furthermore, the newly created window
does not handle new events (other bugs related to this) and it may obscure the
modal dialog entirely.
Need some way to get this to work. Either:
1) show() should automatically bring non-modal windows up behing modal dialogs
(any maybe their parent frames)
2) have some way to programatically inspect the list of open windows by z-
poition and bring up a window in something other than the front position.
Note: waiting for the user to dismiss the modal diaog is not an option - the
new window which comes up is urgent in our applciation and needs to be seen
immediately so the user can act on it.
To reproduce, run the following app and click "Do it" a modal dialog will come
up and 5 seconds later a new JFrame will be created and shown. The newly
created frame obscures the modal dialog and does not accept events.
import java.awt.event.*;
import javax.swing.*;
public class TrivialApplication {
public static void main(String args[]) {
final JFrame mainFrame = new JFrame("Main");
JButton doItButton = new JButton("Do it");
doItButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doIt(mainFrame);
}
});
mainFrame.getContentPane().add(doItButton);
mainFrame.pack();
mainFrame.show();
}
public static void doIt(JFrame parentFrame) {
waitAndShowJFrame();
showModalDialog(parentFrame);
}
public static void showModalDialog(JFrame parentFrame) {
JDialog modalDialog = new JDialog(parentFrame, "Modal", true);
modalDialog.pack();
modalDialog.setBounds(100, 100, 100, 100);
modalDialog.show();
}
public static void waitAndShowJFrame() {
new Thread() {
public void run() {
try {
sleep(5000);
JFrame frame = new JFrame("new non-modal frame");
frame.pack();
frame.setBounds(50, 50, 200, 200);
frame.show();
} catch(InterruptedException ie) {
System.out.println("unexpected InterruptedException");
}
}
}.start();
}
}
(Review ID: 137207)
======================================================================
###@###.### 10/4/04 16:52 GMT
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
There are many bugs which touch upon this issue (modal dialog and non-modal
window behavior), but I couldn't find one with this spin:
I have an application that needs to bring up warnings in response to server-
generated (i.e. not user-generated) events. If there is a modal dialog up when
I need to bring the new window, there's no way to bring it up behind the modal
dialog. show() forces it to the front. Furthermore, the newly created window
does not handle new events (other bugs related to this) and it may obscure the
modal dialog entirely.
Need some way to get this to work. Either:
1) show() should automatically bring non-modal windows up behing modal dialogs
(any maybe their parent frames)
2) have some way to programatically inspect the list of open windows by z-
poition and bring up a window in something other than the front position.
Note: waiting for the user to dismiss the modal diaog is not an option - the
new window which comes up is urgent in our applciation and needs to be seen
immediately so the user can act on it.
To reproduce, run the following app and click "Do it" a modal dialog will come
up and 5 seconds later a new JFrame will be created and shown. The newly
created frame obscures the modal dialog and does not accept events.
import java.awt.event.*;
import javax.swing.*;
public class TrivialApplication {
public static void main(String args[]) {
final JFrame mainFrame = new JFrame("Main");
JButton doItButton = new JButton("Do it");
doItButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doIt(mainFrame);
}
});
mainFrame.getContentPane().add(doItButton);
mainFrame.pack();
mainFrame.show();
}
public static void doIt(JFrame parentFrame) {
waitAndShowJFrame();
showModalDialog(parentFrame);
}
public static void showModalDialog(JFrame parentFrame) {
JDialog modalDialog = new JDialog(parentFrame, "Modal", true);
modalDialog.pack();
modalDialog.setBounds(100, 100, 100, 100);
modalDialog.show();
}
public static void waitAndShowJFrame() {
new Thread() {
public void run() {
try {
sleep(5000);
JFrame frame = new JFrame("new non-modal frame");
frame.pack();
frame.setBounds(50, 50, 200, 200);
frame.show();
} catch(InterruptedException ie) {
System.out.println("unexpected InterruptedException");
}
}
}.start();
}
}
(Review ID: 137207)
======================================================================
###@###.### 10/4/04 16:52 GMT
- relates to
-
JDK-6272277 PIT. Frame does not open behind a modal dialog
-
- Closed
-