Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting events for a whole frame

Status
Not open for further replies.

zippy007

Programmer
Dec 9, 2002
4
0
0
BE
I wonder if it is possible to define a MouseListener on an Internal Frame (MousePressed Event) so the Listener will be applyed on all the frames children.

What I have is an General Internal Frame (which will be extended by all my internal frames). My problem setting the mouse listener on it is that it will not work on the components in the frame.
(See java def on Mouse Event : "A mouse action is considered to occur in a particular component if and only if the mouse cursor is over the unobscured part of the component's bounds when the action happens. Component bounds can be obscurred by the visible component's children or by a menu or by a top-level window.")

So it nearly never work as most of the time there are other components added in the frame that obscurre the frame.

I wondered if I could do it so whatever I add in the frame would react to the same event.


Thank you


Cécile Hayez
 
My advice would be to create a general mouse listener class and give instances of that class to each component so that in essence every section that you wish to fire the listener would. Just a suggestion.

JavaDude32
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top