• 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

JFrame or JDialog

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my history of writing Swing apps if I needed to spawn additional windows for whatever reason off my main JFrame I have just always used a JDialog. But none of them are modal. So I'm wondering if, aside from the modal part which I don't use, is there any advantage/disadvantage to using a JDialog instead of a JFrame for extra windows? Or am I just the same using a JFrame.
Thanks.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Frame can be maximum and minimum and dialog cannot, in office software, it cannot use multiple document interface, just open new frame for every file, in this case, you cannot use dialog.
In other case, use dialog is preferred.
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gregg,
I only use JDialogs for preference boxes, login boxes, etc. The main reason I use them is for their automatic blocking. Of course, for them to block, you have to set them modal.
Good Luck!
 
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Greg,
I think it depends a bit on your users. My users are average office admin types. I have used JOptionPane but found that most of my users would eventually complain that my app froze. In about three cases where I was able to investigate, I found that they had somehow managed to hide the dialog box behind the main app which then appeared dead. I could get to the dialog box with alt tab but this is not something I could expect the users to do. I have not been able to duplicate this behaviour for myself but I am now rather more reluctant to use modal screens.
My app (about 10 screens) is now arranged as a tabbed pane and that has been pretty successful.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The main reason I use them is for their automatic blocking
As I said, none of mine are going to be modal so I don't have to worry about that issue.
I have used JOptionPane but found that most of my users would eventually complain that my app froze
Did I say something about a JOptionPane in my question? BTW - The reason your users are having that problem is because you aren't specifying the parent frame for the JOptionPane to be modal to. If you specify the parent frame the JOptionPane cannot get lost behind it.
The Frame can be maximum and minimum and dialog cannot,
This seems the only valid reason so far however, I can disable window decorations on my JFrame and then the user won't be able to minimize/maximize. So does anyone else have any viable reasons?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic