Results 1 to 2 of 2
  1. #1
    bikashg is offline Member
    Join Date
    Apr 2010
    Posts
    13
    Rep Power
    0

    Default Mouselistener for a Jscrollpane which contains Jpanel within it.

    I have JPanel contained inside Jscrollpane. I want to trap mouse events when user clicks anywhere on JScrollpane. I have implemented a mouselistener within JScrollpane class.

    My problem is that the mouse events are not properly captured. Since Jpanel is inside the area of Jscrollpane, I expect that when I click on Jpanel Area, the Jscrollpane should receive the mouse events too. But it is not happening.

    Is there a way to solve this problem? Please help.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Can you give a little more detail on what you're trying to do? Why do you want both the JScrollPane (or perhaps its viewport) and the contained JPanel to receive mouse events? What actions will be triggered in the scrollpane by the events and what actions in the JPanel? Can you post a small compilable program that demonstrates the set up as best you can?

Similar Threads

  1. can't get x and y from mouselistener
    By j2me64 in forum Java 2D
    Replies: 3
    Last Post: 04-24-2010, 04:57 PM
  2. Replies: 3
    Last Post: 02-06-2010, 03:28 PM
  3. MouseListener & GUI
    By Suurisa in forum New To Java
    Replies: 2
    Last Post: 10-27-2009, 12:52 AM
  4. i need help for MouseListener
    By sfaxianovic in forum New To Java
    Replies: 2
    Last Post: 08-21-2008, 03:30 AM
  5. MouseListener
    By Aswq in forum New To Java
    Replies: 12
    Last Post: 07-18-2008, 08:10 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •