Article View: borland.public.jbuilder.java.swing
Article #1135Re: Mouse moved event
From: John McGrath [TeamB]
Date: Fri, 12 Mar 2004 21:25
Date: Fri, 12 Mar 2004 21:25
36 lines
2570 bytes
2570 bytes
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:
<40522ac0@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>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 13:39:59 PST From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: Mouse moved event 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> User-Agent: XanaNews/1.16.1.11 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 151.197.214.141 Message-ID: <40522ac0@newsgroups.borland.com> Date: 12 Mar 2004 13:25:20 -0800 X-Trace: newsgroups.borland.com 1079126720 151.197.214.141 (12 Mar 2004 13:25:20 -0800) Lines: 36 X-Authenticated-User: jpmcgrath 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