hi there
i have the following code:
@Override
public void onButton(int button, boolean pressed, int x, int y) {
if (pressed == true && button == 1) {
new CP_Tagging(x,y);
}
}
the problem know is that the mouse click is multiple time when i press the mouse button. how can i make it, that the class is only constructed once?
nymon
2
Can you give more information? Your use case and the code surrounding this?
hevee
3
This could help you, but mind you there might be better solutions, so you'll still want to do what nymon suggested and provide some more information.
private boolean isButtonDown;
@Override
public void onButton(int button, boolean pressed, int x, int y) {
if (pressed == true && button == 1 && !isButtonDown) {
new CP_Tagging(x,y);
isButtonDown = true;
}
else if(pressed == false && button == 1){
isButtonDown = false;
}
}