JOptionPane returns null if the user clicks on cancel. Otherwise the value will be returned. I figured that out using this small example:
public class JOptionPaneTest {
public static void main(String[] args) {
Object obj = JOptionPane.showInputDialog(null, "test", "test-text");
System.out.println(obj);
}
}