Event Handling


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Event Handling

  1. #1
    Maria Guest

    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

  2. #2
    Paul Clapham Guest

    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




  3. #3
    Andy Guest

    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 !

  4. #4
    mohan Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center