you must have to set the following property true for add listener on JDialog.
jDialog.setFocusable(true);
then by adding key listener you can disable the or avoid the escape key by following code
jDialog.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
write any code related to kdy
}
});