you handle events 4 ways that i know of
1. implement the listeners. you will find this can get long and complicated with lots of if else statements
2. anonymous inner class
3. named inner class //my favorite so far
4. a separate top level class.
i misunderstood your question. you can do that a couple different ways also
1. pass a reference to "this" to the listener and make a variable package access so the listener can access it
2. pass a reference to "this" to the listener and supply get methods //i would go with 1 instead
in other
word you have to write a constructor for your event handler sort of like this
myEventHandler(MyClass parent){}
there might be other ways i am unaware of
of course if your main class and the listener class are in different folders it kind of complicates things
you will have to do imports, and option 1 would change to making the variables pulic.