• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dialogs lose focus when minimizing and restoring the application

 
Jeff Chang
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Dima Riabin
Greenhorn
Posts: 18
MyEclipse IDE Windows Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dima Riabin
Greenhorn
Posts: 18
MyEclipse IDE Windows Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Govind Kurup wrote: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..


Thanks. That was exactly what it was. There was null passed as a parent parameter....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic