JSarma
asked on
Mouse listening in JPanel
Hi Experts,
I am using JPanel in JFrame. I added MouseListener, MouseMotionListener to JPanel. Now when i click on the JPanel, mousePressed event is executing. Then i added three JEditorPanes, in the JPanel. When i click on the JEditorPane, in the JPanel my mouseListener is not getting executed. Why this behavi3F. I created one more class that extends JEditorPane and added MouseListener to it. I added this derived class to JPanel, then also the same behaviour. What is the problem?. Please help me
Thanks in Advance
Regards Jagannadh
S/W JDK 1.2.1
O/s 95/NT
I am using JPanel in JFrame. I added MouseListener, MouseMotionListener to JPanel. Now when i click on the JPanel, mousePressed event is executing. Then i added three JEditorPanes, in the JPanel. When i click on the JEditorPane, in the JPanel my mouseListener is not getting executed. Why this behavi3F. I created one more class that extends JEditorPane and added MouseListener to it. I added this derived class to JPanel, then also the same behaviour. What is the problem?. Please help me
Thanks in Advance
Regards Jagannadh
S/W JDK 1.2.1
O/s 95/NT
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question was awarded, but never cleared due to the JSP-500 errors of that time. It was "stuck" against userID -1 versus the intended expert whom you awarded. This corrects the problem and the expert will now receive these points; points verified.
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
Thank you,
Moondancer
Moderator @ Experts Exchange
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
Thank you,
Moondancer
Moderator @ Experts Exchange
To fix this, you need to have call addMouseListener on each of your JEditorPanes with the same MouseListener that you added to your JPanel. This should cause the MouseEvents to occur as you expect.