Skip to content

Instantly share code, notes, and snippets.

@wytten
Created March 21, 2013 14:35
Show Gist options
  • Save wytten/5213495 to your computer and use it in GitHub Desktop.
Save wytten/5213495 to your computer and use it in GitHub Desktop.
Popup a swing dialog to accept user input in Groovy
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