Dialogs lose focus when minimizing and restoring the application
Jeff Chang
Greenhorn
Joined: Aug 23, 2001
Posts: 23
posted
0
Hi, I have a problem as below: Dialog(s) lose focus when minimizing and restoring the application and therefore fall behind the main application window. The user is required to find and close the dialog(s) before continuing with any other operation. This occures when the user clicks the Show Desktop icon in the task bar. Restore the application by clicking on the application icon in the task bar. Observe: The dialog has fallen behind the main application window. Must presee Alt + Tab keys to restore focus on the dialog. Anybody knows how to solve such a problem? Thanks anyway. Jeff
How do you minimize the App with a Dialog window open? When my dialogs open, I can't do anything until I lose the Dialog. That includes minimizing any part of my App. Also, are you using AWT or SWING. ------------------ Happy Coding, Gregg Bolinger
Oh, sorry about that last replay. I just figured out what you meant. Sorry about that. I am looking into it though.
------------------ Happy Coding, Gregg Bolinger
Govind Kurup
Greenhorn
Joined: Sep 04, 2001
Posts: 1
posted
0
Hello, Have you used "null" as the parameter for showSaveDialog(Component parent)/ showOpenDialog(Component parent) function. If so then replace null with the main JFrame class instance (assuming your main class is a JFrame). It should work.. Bye
Originally posted by Jeff Chang: Hi, I have a problem as below: Dialog(s) lose focus when minimizing and restoring the application and therefore fall behind the main application window. The user is required to find and close the dialog(s) before continuing with any other operation. This occures when the user clicks the Show Desktop icon in the task bar. Restore the application by clicking on the application icon in the task bar. Observe: The dialog has fallen behind the main application window. Must presee Alt + Tab keys to restore focus on the dialog. Anybody knows how to solve such a problem? Thanks anyway. Jeff
Hi, I just had the same problem with somebody's code, I inheritted. The way I solved it was that when the dialog was opened, the dialog is a class extending from JDialog and the previous programmer was instantiating with the constructor taking JFrame as a parameter. The frame object was a new object for some reason. That's why dialog had no connection with your main application window.
You have to give "this" instead of a new JFrame. Provided your main application window is a JFrame.