-
Event Handling
I'm having trouble handling mouse events. Basically, I have a panel, that
contains a panel and two scrollbars. The inner panel is made up of hundreds
of tiny little canvases. When the user clicks, anywhere in any of the canvases,
I want to catch that mouse event. I tried making the whole inner panel a
mouse listener, and I tried to make the panel also containing the scrollbars
the mouselistener. Nothing is catching the event. Do I have to add mouse
listeners to each individual canvas?
Maria
-
Re: Event Handling
That would probably work, and it wouldn't be as much work as you make it
sound if the "canvas" were a subclass with the appropriate coding.
Maria <mstidle@andrew.cmu.edu> wrote in message
news:38d8c3e6$2@news.devx.com...
>
> I'm having trouble handling mouse events. Basically, I have a panel, that
> contains a panel and two scrollbars. The inner panel is made up of
hundreds
> of tiny little canvases. When the user clicks, anywhere in any of the
canvases,
> I want to catch that mouse event. I tried making the whole inner panel a
> mouse listener, and I tried to make the panel also containing the
scrollbars
> the mouselistener. Nothing is catching the event. Do I have to add mouse
> listeners to each individual canvas?
>
> Maria
-
Re: Event Handling
why not use one canvas and buffer anything you want to draw onto it, use the
Graphics or Graphics2D of the canvas and double buffer it....as you draw
onto areas of the g object record the x,y,+x,+y coordinates into a Vector,Hashtable
or collection....lots of mouseListeners means lots of memory !
-
Re: Event Handling
"Maria" <mstidle@andrew.cmu.edu> wrote:
>hiiii
>I'm having trouble handling mouse events. Basically, I have a panel, that
>contains a panel and two scrollbars. The inner panel is made up of hundreds
>of tiny little canvases. When the user clicks, anywhere in any of the canvases,
>I want to catch that mouse event. I tried making the whole inner panel
a
>mouse listener, and I tried to make the panel also containing the scrollbars
>the mouselistener. Nothing is catching the event. Do I have to add mouse
>listeners to each individual canvas?
>
>Maria
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks