• Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt with this component

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is MouseAdapter a swing component?
 
Michael Labuschagne
Ranch Hand
Posts: 56
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have much idea but,
As per i know
mouseAdaptor is an interface...........
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys i know it is a awt component . but i want to know if there is any swing component
 
Michael Labuschagne
Ranch Hand
Posts: 56
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12340
38
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to move this to the Swing forum, where you should get a better response.
[ August 03, 2007: Message edited by: Fred Rosenberger ]
 
Brian Cole
Author
Ranch Hand
Posts: 920
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!