-2

I would like to have a customized InputDialog so that following code could work. I am creating an old fashion application. The InputDialog will be created once users click a button on a view. I am wondering if we could create a customized input dialog to have the feature that my title says. Just let me know if anything is unclear.

String s = MyCustomInputDialog("my question"); // show the input dialog that will be either closed in 5 seconds or closed by the user's action

System.out.println(s) // print null or print user's input

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
die
  • 57
  • 1
  • 8
  • 6
    Welcome to Stackoverflow. What did you try to solve this? Consider reading [ask] again as it improves chances getting quality answers. SO is not thought to produce the code for you but rather to support with specific probelms. Also include your code (what you tried) as a [mre] – Björn Apr 13 '20 at 13:20

1 Answers1

0

Check answers over in Closing A JOptionPane Programmatically , which has a really interesting hack to loop through all Windows to find the JOptionPane and kill it.

Falkreon
  • 598
  • 5
  • 14