Disposing a dialog in touch devices in lwuit
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 tr开发者_Go百科ue
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()]));
}
}
the bug was in checking contains(x,y)
. I replaced it with this.getContentPane.contains(x,y)
and that has fixed the issue
精彩评论