aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JFrame or JDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame or JDialog" Watch "JFrame or JDialog" New topic
Author

JFrame or JDialog

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Fuqiang Zhao
Greenhorn

Joined: Jan 07, 2004
Posts: 24
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.
Jason Steele
Ranch Hand

Joined: Apr 25, 2003
Posts: 100
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!


An egg is a chicken's house!
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
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.


The nice thing about Standards is that there are so many to choose from!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFrame or JDialog