Article View: borland.public.jbuilder.java.api
Article #3166Event Handling
From: Dean Henkel
Date: Thu, 09 Apr 1998 00:00
Date: Thu, 09 Apr 1998 00:00
34 lines
1729 bytes
1729 bytes
I've got a question regarding Event Handling, specifically catching
mouse events.
My application usesSwing Controls. I've got a JFrame, which contains a
JPanel, which Contains a JSplitFrame, which contains some controls in
each pane.
JFrame
JPanel
JSplitFrame
JButton
JTextField
What I would like to do is have the JPanel catch a mouse move event when
the mouse moves any place over the pane, (which would be over the
JButton or the JTextField since they take up the entire panel). I've
implemented the processMouseMotion() method in the JPanel class.
Unfortunately the method never gets called. I added the
processMouseMotion() to the JSplitFrame() class, and it gets called when
the mouse cursor is over the slider portion of the window but not over
any of the controls within the split panes.
I assume the control's(JButton, JTextField) are eating the mouse events
and they never get passed to container classes.
What is the procedure for passing events to container classes. Must the
containers have a processMouseMotion() and call the containers
processMouseMotion() assuming the component has a handle to the
container? Examples would be helpful.
Thanks.
Dean
Technical Details
Message-ID:
<352D293D.8910A9E3@us.ibm.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,1ba7feb2c73626b1,start X-Google-Attributes: gid1089d0,public From: Dean Henkel <henkel@us.ibm.com> Subject: Event Handling Date: 1998/04/09 Message-ID: <352D293D.8910A9E3@us.ibm.com> X-Deja-AN: 342517358 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.api