Search code examples
javaintellij-ideacrashjoptionpane

JOptionPane.showInputDialog Makes my program crash


I've used this input dialog before but for some reason it is making my program crash. I've tried adding different options to the input dialog but i get the same results

The error message on Intelliji is "Process finished with exit code -805306369"

JOptionPane pane = new JOptionPane(); 
String name = pane.showInputDialog("Name Your Profile");

SaveParameters(name);  //this is what takes the output

Solution

  • Realized this was caused by the window displaying behind my main UI, which caused the UI to crash when i clicked to focus the main UI again.

    Giving a null argument to the Component argument fixes the problem.

    String Name = JOptionPane.showInputDialog(null,"Name Your Profile");