To simply put it, when you press the button( as i have understood ) you want to do something like this:
JOptionPane.showMessageDialog(yourFrame,"This is the error message that you want to display");
Here is the link from docs.oracle.com for better information about JOptionPane:
http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html[
^]
You have the possibility as well to choose what kind of message you want to display(Error Message, Information Message etc.), it's all in the link above.
Best regards.