Article View: borland.public.jbuilder.java.swing
Article #1136Re: Mouse moved event
From: George
Date: Fri, 12 Mar 2004 22:19
Date: Fri, 12 Mar 2004 22:19
44 lines
2907 bytes
2907 bytes
Ah ok. One adapter class but two separate registrations. I could kick myself now. :-) Thank for your help. George "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:40522ac0@newsgroups.borland.com... > On 3/10/2004 at 2:36:08 PM, George wrote: > > > As it stands it doesnt work when I register a MouseInputAdapter on > > the list. However if you comment out that code and instead register > > a MouseMotionListener on the list (just uncomment the section I have > > commented), it works correctly. > > The behavior you describe is exactly what I would expect. > > The code registers a MouseListener with the JList. In other words, it > asks the JList to call the listener's mouseClicked(), mouseEntered(), > mouseExited(), mousePressed(), or mouseReleased() methods whenever the > corresponding event occurs. > > The object that you pass to addMouseListener() is an anonymous subclass > of MouseInputAdapter. Since this class implements the MouseListener > interface, it is acceptable to pass the object to addMouseListener(). > > MouseInputAdapter provides empty implementations of the 5 methods > listed above and these methods are not overridden in your anonymous > subclass, so those empty implementations are called whenever the > corresponding events occur. > > The fact that the object you pass to addMouseListener() implements the > MouseMotionListener interface does not cause the JList to notify it of > the MouseMotion events. In order for that to happen, you must register > it with the JList using the addMouseMotionListener() method. > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<4052370a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!petbe.visi.com!news.octanews.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<404c9077$1@newsgroups.borland.com> <404e24cf@newsgroups.borland.com> <404f4bed$1@newsgroups.borland.com> <404f6e20$1@newsgroups.borland.com> <40522ac0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f868ea1e3b9ad81 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2004-03-12 14:40:25 PST From: "George" <geo_54321@yahoo.com> Newsgroups: borland.public.jbuilder.java.swing References: <404c9077$1@newsgroups.borland.com> <404e24cf@newsgroups.borland.com> <404f4bed$1@newsgroups.borland.com> <404f6e20$1@newsgroups.borland.com> <40522ac0@newsgroups.borland.com> Subject: Re: Mouse moved event Date: Fri, 12 Mar 2004 17:19:10 -0500 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 63.119.115.129 Message-ID: <4052370a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1079129866 63.119.115.129 (12 Mar 2004 14:17:46 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!petbe.visi.com!news.octanews.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail