Why when I close a JOptionPane, does It give me an exception? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why when I close a JOptionPane, does It give me an exception?

Sorry if is bad written.

4th Feb 2020, 12:46 AM
Solestebano
4 Answers
+ 1
There are dozens of exceptions that can get thrown by the JOptionPane class - show us the code and maybe we can help Or at least what kind of exceptional you're getting.
4th Feb 2020, 12:52 AM
HNNX 🐿
HNNX 🐿 - avatar
+ 1
OK I'll try to run the code post my findings :)
4th Feb 2020, 1:42 PM
HNNX 🐿
HNNX 🐿 - avatar
0
try{ int num = Integer.parseInt(JOptionPane.showInputDialog("Number: ")); JOptionPane.showMessageDialog(null,"Your number: " + num); }catch(Exception e){ JOptionPane.showMessageDialog(null, "That's not a number"); }
4th Feb 2020, 1:08 AM
Solestebano
0
When I close the JOptionPane that asks for a number, I get the exception I have for an invalid value.
4th Feb 2020, 1:10 AM
Solestebano