• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bringing specific Jdialog to front when having multiple jdialogs in one application

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have multiple JDialogs in my application stored in a map. These JDialogs are all have


When these dialogs are out of focus and I want to bring a specific JDialog toFront all JDialogs come toFront. I want the specific Jdialog to come to front and want the other JDialogs to remain in back.


This code brings all the JDialogs toFront having the specificJDialog on top of the stack.


This Method only returns a HashMap nothing else.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome

Is there a question in your post?
 
N A Khan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

Yes, actually I have explained the scenario and my question was: How can I bring the specific JDialog to front while other JDialogs in the map remains in back?
 
N A Khan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,
I found a solution to my problem I think it is worth sharing it.

Solution: Creating multiple JDilogs in an application with default constructor i.e. will result in a shared frame as the parent of each JDialog which will cause these kind of problems. So I used the overloaded constructor to have separate parent for each JDialog and that solved my problem.

Thanks!
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might consider "new JDialog(null)" instead -- the documentation says that this is the only way to produce an "unowned" JDialog. It's possible that unowned JDialogs would act the way you want them to act, and then you wouldn't have to create the extra JFrame objects which you are now creating. Not that they are a big problem, but they are a solution which merits a comment to explain to future readers of the code why it was done.
 
N A Khan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:You might consider "new JDialog(null)" instead -- the documentation says that this is the only way to produce an "unowned" JDialog. It's possible that unowned JDialogs would act the way you want them to act, and then you wouldn't have to create the extra JFrame objects which you are now creating. Not that they are a big problem, but they are a solution which merits a comment to explain to future readers of the code why it was done.



"new JDialog()" and "new JDialog(null)" both are internally calling the overloaded constructor "new JDialog(null, false)" which means they have no difference, they do create "unowned" JDialogs but doesn't solve the original problem.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the feedback. Looks like the solution you found is indeed the solution for your problem, then.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic