• 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

JOptionPane buttons

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JOptionPane that contains a JPanel which has a text field on it.
When the user hits enter after they key into the text field, it should pull up some db info. However, when they hit enter, the option pane closes, rather than staying up. How can I tell my JOptionPane not to close unless the user actually pressed the OK button or closed the dialog ('X') with their mouse?

Thanks in advance!
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the JOptionPane showXXX method returns the dialog closes. You can open another one each time you get input and want to continue (shown below). Or, instead of using JOptionPane you could make a JDialog with your components and control it from within your event code.
reply
    Bookmark Topic Watch Topic
  • New Topic