Created
March 21, 2013 14:35
-
-
Save wytten/5213495 to your computer and use it in GitHub Desktop.
Popup a swing dialog to accept user input in Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.* | |
def prompt = { | |
JFrame jframe = new JFrame() | |
String answer = JOptionPane.showInputDialog(jframe, it) | |
jframe.dispose() | |
answer | |
} | |
def first = prompt("Enter a number") | |
def second = prompt("Enter another number") | |
System.out.println(first + second) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment