Results 1 to 4 of 4
- 07-27-2011, 07:57 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 1
- Rep Power
- 0
JOptionPane.showOptionDialog(null....) does not show up the dialog at all.
Hello guys,
I used JOptionPane.showOptionDialog(null,....). Null as first parameter indicates that the parent for this dialog is not known.
My question here is if I run the code from eclipse, sometime I see the dialog coming under the main window and sometimes over the main window of my application (centered).
However, if I run the application from release build (Made local build using eclipse and installed the application), the dialog does not come up at all and the application freezes. It looks like the application is blocked due to dialog not coming up.
Can you please tell me why this difference when run from eclipse and from build?
Help will be appreciated.
Thanks,
bristow
- 07-27-2011, 10:11 AM #2
1. Is your 'main window' set to always-on-top?
2. Does your code respect Swing's single threaded rule?
3. What problem do you have in parenting the dialog appropriately? A null parent is usually passed only when there isn't another window visible.
Oh, and
Don't waste time with irrelevant stuff that won't help solve your problem.Can you please tell me why this difference when run from eclipse and from build?
db
edit
More likely the dialog is being shown behind the frame (in zOrder)the dialog does not come up at all and the application freezes. It looks like the application is blocked due to dialog not coming up.Last edited by DarrylBurke; 07-27-2011 at 10:20 AM.
- 07-28-2011, 03:30 AM #3
I just tried this using Netbeans and Eclipse:
Java Code:package joptiondialog; import javax.swing.JOptionPane; /** * * @author BN */ public class JOptionDialog { public static void main(String[] args) { JOptionDialog m = new JOptionDialog(); m.showDialog(); } public void showDialog() { JOptionPane.showMessageDialog( null, "Hello, this is a message.", "Information", JOptionPane.INFORMATION_MESSAGE ); } }
- 07-28-2011, 07:52 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Your code doesn't control the positioning of the dialog, on top, on bottom as Darryl explains to you. So the dialog will appear on top by default when you run with NetBeans (I hope the same with Eclipse). You may be click on other window on your desktop before the message box pops up, then the message will appear at the bottom. That's not relevant with Java, controlled by the OS itself.
Similar Threads
-
Help with closing JOptionPane.showOptionDialog
By Rafik in forum New To JavaReplies: 3Last Post: 06-07-2011, 06:42 AM -
JOptionPane dialog (Localizing)
By Java Tip in forum Java TipReplies: 0Last Post: 03-14-2008, 11:36 AM -
Adding custom buttons - JOptionPane.showOptionDialog(...)
By Java Tip in forum Java TipReplies: 0Last Post: 12-17-2007, 09:46 AM -
JOptionPane - message dialog
By Java Tip in forum Java TipReplies: 0Last Post: 12-17-2007, 09:11 AM -
JOptionPane - input dialog
By Java Tip in forum Java TipReplies: 0Last Post: 12-17-2007, 09:09 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks