Click to See Complete Forum and Search --> : Adding Mouse Listener


jags
July 27th, 1999, 05:16 AM
Hi Gurus,

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 behavi

unicman
July 27th, 1999, 10:29 PM
JPanel is a container. U will get any Event only if u click or do something in JPanel area. When u put a JEditorPane (or any component) in that JPanel, the area enclosing JEditorPane is kind of given to that component. The area excluding all the components in the JPanel is JPanel's area where u get the events.

If u want to handle events in the area of JEditorPane, u will need to add MouseListener to that component.

- UnicMan
http://members.tripod.com/unicman