Let me see if I can explain this without posting code.
I have a GUI class that extends JFrame and implements listeners, so the calss itself is the listener. The handlers are overriden in this calss.
In my driver class, I create a vector to hold instances of of type derived Vehicles (my abstract class), with the specific instances being "vanilla" cars, family cars, economy cars, and motorcycles.
I create the vector outside of the GUI calss so that I can reference it outside of a GUI instance. I pass the vector to the GUi constructor, and it adds the vector to a JList and a JComboBox. That is a bit reundant, but I wanted to play with both components so I could learn them.
Now for the event handling, I wanted to be able to add vehicles, remove vehicles, and sell vehicles from the handles on the buttons named "sell," "remove," and "add."
I'd like for the vector to be updated with these actions. I have code in the definition of actionPerformed.
For example, when a user wants to add a vehicle, I have input to select the vehicle type, and then prompt the user for info to store, and then pass to a new vehicle instantiation. I wanted this new object to be added to the vector, and then added to the combo box and list.
However, in my class definition it says that I cannot access the vector refeence variable that is declared in main, and then passed to the GUI contructor.