I want to show a warning so that one JTextField should not be left blank. I used the focusLost method of focuslistener. In this method i used JOptionPane.showMessageDialog(this, "do not leave blank", "Blank", JOptionPane.INFORMATION_MESSAGE). I got this message box as I leave that text field (when it is blank). However, I do not know how to get rid of this message. Kindly advice. Also note that focusLost() method is void and cannot return any integers.