Reputation: 800
How do I make a dialog that has a text at the top and under it a blank space where the user can type and under it on the right an OKAY button where when you click on it the dialog disappears?
Like this:
Upvotes: 1
Views: 2865
Reputation: 168845
String input = JOptionPane.showInputDialog(..);
For more information see How to Make Dialogs. Here is an example from that document.
String s = (String)JOptionPane.showInputDialog(
this,
"Complete the sentence:\n"
+ "\"Green eggs and...\"",
"Customized Dialog",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"ham");
Upvotes: 4