• 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

how to manage the dissmissal of joptionpane when any button is clicked

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! is there a way to manage the buttons of JOptionPane such that they do not just close when any of them is closed. For example I'm creating a program whereby the user enters username and password through JOptioPane which should only be dismissed if the user enters correct values and clicks ok or when the user clicks cancel. The problem is by default clicking any button dismisses the dialog. I've done all the necessary work of accessing the database and comparing database values with user values when ok is clicked but I don't know how to control the dialog not to dimiss after ok is clicked and username and password don't match. The code fragment for my JOptionPane is shown below
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Easiest way: don't use JOptionPane#showConfirmDialog, use a modal JDialog. Alternatively redisplay the JOptionPane in a loop.
reply
    Bookmark Topic Watch Topic
  • New Topic