Learn To Resolve Joptionpane Error Message Instantly.

Hello everyone,
I am using Java language for one of my project that I have to submit within some time. I want to show an error using joptionpane error message when user accidentally clicks on a button.
Can someone tell me how to use joptionpane to display such a message?
