This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPane.showInputDialog Arguments?  RSS feed

 
Steve Stephenson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


There is my code so far, on the line , eclipse gave me 2 extra arguments following the icon and I'm not sure what exactly goes into the 2nd to last, the "selectionValues" argument.

After checking the Java docs, it was apparent that the option buttons goes into the selectionValues argument, but is there a way to work past that if I would only like the default (OK, Cancel) buttons on my window? The school haven't taught us the method to create custom buttons and I doubt I would've been set something that was not taught.
 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The API docs show the showInputDialog method is overloaded to provide several levels of control from a very basic single parameter version to one with 7 parameters. The trick is to read the API docs and pick the one with the minimum number of arguments that suits your requirements.
 
Campbell Ritchie
Marshal
Posts: 55694
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

I shall move this discussion to the GUIs forum where we usually discuss option panes.
The API documentation is clear, but you may find the Java┬« Tutorials easier to read. Use ctrl‑F‑“dialog”. If you don't have a GUI for the option pane to appear in front of, use null for the first argument. Then it appears in the centre of the screen. Beware: I have known it to appear in the centre of the screen but behind all the other windows, so search the task bar for the cup of coffee icon.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!