Hi there I have an (ButtonManager)object that contains a vector. this ButtonManager calls a GUI to start with an instance of itself. The GUI has a few buttons; their actionListeners are in an inner class. Every time a button is hit, the actionPerformed-method has to search in the vector the demanded element and to modify it. My problem is that I cannot access the vector out of this inner class. (Compiler says: local variable bm is accessed from within inner class; needs to be declared final.) Can somebody help? Thanks, Liza
I can see several possibilities for this: How about the "self shunt" pattern. Don't other with the inner classes, implement the listeners directly in the manager class, and decide what to do on which button the click was for (it's in the Event). How about making the listeners "real" classes, and passing the Vector into the Constructor? Are you sure you really need to search the whole Vector in each listener? If every action causes a button listener to search for the same element in the vector, why not pass in something else (the element itself, the vector and the index of the element in the Vector) to the constructor? Have any of these options helped ?