SwingUtilities.isLeftMouseButton, count-variable
Hi,
in my mouseClicked method I have a if-statement to see which mouse button has been pressed. If the left mouse button has been pressed I would like to increase an int variable:
publicvoid mouseClicked(MouseEvent evt){
if (SwingUtilities.isLeftMouseButton(evt){
lmClicked++;
if (lmClicked > 1) allowClick =false;
(...)
However, lmClicked stays at 1no matter how often I left click. Why?
[661 byte] By [
SFLa] at [2007-11-27 9:53:44]

# 1
> However, lmClicked stays at 1no matter how often I left click. Why? Your code is wrong and since you didn't post your SSCCE, we can't guess what the rest of your code is doing.
# 2
The rest of the code is just too much to be posted. The code within the mouseClicked method works, however, the count variable isn't added up, it stays at 1. I don't change any of these variables anywhere else.Is this maybe due to how Java handles mouse events?
SFLa at 2007-7-13 0:23:04 >

# 3
> The rest of the code is just too much to be posted.
I didn't ask for the rest of the code. I asked for a SSCCE (which you've been asked for in the past I'm sure).
You should be able to create a simple demo in about 15 lines of code that does what you want. Once you understand the basics you incorporate the simple code into your main program.
> Is this maybe due to how Java handles mouse events?
It has nothing to do with how Java handles event. It has to do with a bug in your code.