Java add mouseListener and use local variables inside?

You can use local variables declared as final : final int index = getProductIndex and the same for a.

You can use local variables declared as final: final int index = getProductIndex... and the same for a.

What I'm trying to do is use local variables inside of the mouseListener I add ( right on that place ). Which seems impossible, so I would like to ask if there's any alternative way for what I'm trying to do. So basicly the problem is: I cannot use local variables ( which in my case contain info about the product clicked on by the user ) inside a mouseListener I add dynamicly.

It's part of a big code so unfortunately I cannot post a full SSCCE with a compile- & execute-ready code. So I tried to just offer the code part that isn't working properly ( which I'm sure it only is this part marked with #s ).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions