I want to giving an alert when there is an exception, like in code:
try
{
//the code here
}
catch(Exception e)
{
//show an alert dialog here
}
An example or a code snippet is what I need.
Message dialogs are created with the JOptionPane. showMessageDialog() method. We call the static showMessageDialog() method of the JOptionPane class to create a message dialog. We provide the dialog's parent, message text, title, and message type.
You can use JOptionPane.showMessageDialog
with WARNING_MESSAGE
:
JOptionPane.showMessageDialog(yourFrame,
"WARNING.",
"Warning",
JOptionPane.WARNING_MESSAGE);
More infos about how to make dialogs here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With