The JFrame you are making is not modal, so when you call 'q.ask()' the method returns immediately without a chance to set q.answer. Ways around this would be to create a modal dialog yourself, use...