No it's something you use in Events in Java. A way of circumventing the need to override all the methods of the interface you implement for a MouseListener
No MouseAdapter is not a swing component as in a graphical component. If you could give a more detailed description of what you are trying to do we could be of more assistance.
Originally posted by prasanna sheregar: is MouseAdapter a swing component?
i know it is a awt component . but i want to know if there is any swing component
Be careful with the term component. To most of us, saying "is a component" means that it is a subclass of java.awt.Component. ("Is a swing component" could even mean that it's a subclass of javax.swing.JComponent, but this is less clear cut. For example, JFrame is a subclass of Component but not of JComponent.)
But MouseAdapter is not a subclass of java.awt.Component, so I would say that MouseAdapter isn't a component at all (neither swing nor awt). This makes sense since there's no way to display a MouseAdapter on the computer screen. So what exactly are you trying to ask?
Maybe this will help you sort out the confusion. Try and map to the MVC architecture. You can think of components as the "View". If they can be displayed on the screen, you can safely think of them as the view. Classes like the MouseAdapter are the "Controller". Though they are not visible, they form the mode of interaction between the user and the view component.
Technically speaking, the MouseAdapter is an adapter class for the MouseListener interface. You can find many such adapter classes corresponding to some iterface. E.g. MouseMotionAdapter(class) --> MouseMotionListener (interface),KeyAdapter (class)-->KeyListener (interface). As Michael rightly pointed out, the idea is to get a "ready made" class which implements the interface containing multiple methods. Then you need to override only the ones you want.
Post by:autobot
It means our mission is in jeapordy! Quick, read this tiny ad!
a bit of art, as a gift, that will fit in a stocking