I am displaying a dialog when a user touches the screen and want the dialog to dispose when the user touches anywhere outside the dialog. I have set setDisposeWhenPointerOutOfBounds()
to true
though by default it is. And I have written the following code in pointerReleased()
event but whenever the user touches the screen outside of dialog the dialog disposes but not without executing the code that should be executed only when the x,y are within the dialog.
public void pointerReleased(int x, int y) {
dispose();
if (contains(x, y)) {
actionCommand((cmds[l.getSelectedIndex()]));
}
}