I didn't realize, until yesterday, that the NetBeans APIs
provide a wide range of descriptions for simple communication with
the user. For example, in the code below, a small dialog box
with an input line (thanks to the
NotifyDescriptor.InputLine class) appears and, depending on the
user's response, your code can branch off in an appropriate
direction. In this case, the getInputText() method is used
to test whether the correct answer is given.
So, when the action is invoked...