Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hi ALL  RSS feed

 
narayana murthy pedapudi
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a JFrame and have some validations in it...In some situations i will display a message using jdialog...unless u click OK application will not go further...problem is if i press ALT+TAB when joptionpane displayed a message..again if i click on the JFrame......joptionpane is not coming tofront....what is the solution for this...
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yourDialog.setModal(true)
 
narayana murthy pedapudi
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I am using Joptionpane...
and one more thing when u press alt+tab this will go back and we cannot do any action on the frame intill we close that... here my problem is that if we highlight the frame we have to get that joptionpane to front...
Thanks and regards
naryana
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JOptionPane is modal (blocks input to its parent component) by default. Are you using one of the JOptionPane static methods, showXXXDialog(), to display the dialog? You will have to show us some code so we can see what you are doing.
 
narayana murthy pedapudi
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
JOptionPane.showMessageDialog(null,"Please Enter File Name","Download",JOptionPane.WARNING_MESSAGE);This is the code i am using.....

Thanks and Regards

Narayana
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by narayana murthy pedapudi:

JOptionPane.showMessageDialog(null,"Please Enter File Name","Download",JOptionPane.WARNING_MESSAGE);

The VM can't block input to a null frame. Replace the first parameter with a reference to your top-most frame. That should give you a modal dialog.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!