Ok, I thought that while I tried to come up with ideas of my own, I could go ahead and get this bruing in your head... I have a dialog that has 3 JSliders..sliderX, sliderY, and sliderZ. These sliders are to manipulate an object on those axis. I also need to manipulate the camera on the same 3 axis so I thought it would be a good idea to reuse my GUI code, but I need to fire different events. So what would be a good way to structure this? I don't really want to use the same class and have some sort of if/else in my ChangeListeners to determine if I am on camera or object. I would rather do something like extending the GUI part and each implementing their own events tha tI override. Maybe I'm overthinking this? Anyone have suggestions on the approach I should take? Thanks.
I did something similar with a TreePopupMenu. And I started overthinking your problem. All I did was create an abstract TreePopupMenu implementation that took care of the gui. I included one abstract method "showTreePopupMenu" that was called by the doMouseAction method of my implementation. I actually posted my code here: Topic: JPopupMenu - setSelected(JMenuItem) My subclasses implement the "showTreePopupMenu" differently, but use all the same code already built into the abstract class. I thought about your situation initially like this: - Create a custom interface like "ThreeWayController" that defines methods that do something with the ChangeEvent. - In the Dialog, perhaps a constructor could accept an object that implements a ThreeWayController, or there could be a setter to put that into a global variable. Then your methods can just call the objects on the ThreeWayController, and the ThreeWayController takes care of the rest... I would imagine a good foray into a patterns book would yield something helpful.