• 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

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone show me some code that allows for 2 JTextFields in a JOptionPane with 3 custom button choices? I need to have a User Name and PAssword input, but the rest of the app needs to be locked with this option up. So just a JFrame or an Internal Frame won't work for me. Thanks
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here's a possible solution:
  • Create a JPanel with all the input components you need
  • Use the showOptionDialog method and use the JPanel you created as the message


  • When you receive the result, you can get the values of each component individually.
    Like this:

    Just one detail, since all those components are the "message", none of them will start with focus.
    Hope it helps.
    Francisco
     
    reply
      Bookmark Topic Watch Topic
    • New Topic