k thnx. i tried this:
private class Listener extends MouseAdapter, WindowAdapter implements ActionListener{//CODE HERE
}
but it give me an error. as u can see im already using a MouseAdapter and an ActionListener so how would i fit a WindowAdapter into the picture?
A class can not extend more than one base class.
You can either implement WindowListener (no limit on number of interfaces implemented),
or write a new class that extends WindowAdapter.
I would go for the second, because I think you are listening to the window
and to the mouse for different reasons, so why stick unrelated code
together in one class? That's a bad design, like combining fields of
information about a Person (name, age, phone number) and fields
of information about a Dog (breed, weight) into a single DogOwner class.
ok ... you get an error because you cannot extend multiple classes. you can impliment multiple interfaces, and extend multiple interfaces with an interface, but you can not extend multiple classes (can you be both whale and human? no, but you could be both male, african american, & human ...)
a better way to go about this (if you are trying to have one listener type class, as in the traditional MVC approach), is to have one class implementing both MouseListener & WindowListener.
(ex class MegaListener implements MouseLIstener, WindowListener )
there are some j-rigged approaches to not having to define all the methods in the WindowListener & MouseListener interfaces, but i encourage you to spend the extra 10 minutes doing it the foolproof way.
good luck!