Input Dialog closes after pressing ok button

I am adding a search for my jtree. I using JOptionPane.showInputDialog(OK_CANCEL) . but the dialog is getting closed after i press ok. ofcourse it execeutes the code for searching. i want to close the dialog only when i press cancel. any help?
[264 byte] By [ganeshaa8a] at [2007-11-26 15:56:49]
# 1
Read this part in the tutorial: http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html#stayup
Rodney_McKaya at 2007-7-8 22:17:39 > top of Java-index,Desktop,Core GUI APIs...