• Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPane  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
Francisco A Guimaraes
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • 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
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!