(Swing) Handling Mouseclicks with nested Objects?
From: Frank Alviani (frank_at_alviani.com)
Date: 12/26/03
- Next message: Andrew Thompson: "Re: How to assign a string buffer to a JEditorPane"
- Previous message: Martin Unzner: "How to assign a string buffer to a JEditorPane"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Dec 2003 07:36:28 -0600
Hello All,
I am developing an app that represents individual web pages as buttons
which are extended from JLabel, so they can be double-clicked to open a
configuration dialog. The class implements the Mouselistener interface
for click handling and Actionlistener to support right-click popup menu
handling. This is all working as designed.
The "page buttons" are grouped inside a PageGroup object which is
extended from JPanel. As they are created, they are attached to the
PageGroup using addMouseListener().
The PageGroup class implements the Mouselistener interface for click
handling and Actionlistener to support right-click popup menu handling.
Multiple PageGroup objects normally exist, nested inside a top-level
class derived from JPanel. My code currently adds them to the outer
object using addMouseListener(), just as the page buttons are added to
the PageGroup objects.
I need to have the PageGroup objects implement right-click menu
processing when a click occurs inside the PageGroup but outside any of
the nested page buttons. However, although I've got the PageGroup class
set up for event handing just like the "page buttons", it is never
receiving mouseclick events.
I have a couple of questions (and of course a plea for help :)
- Is click handling "outermost in" (top-most container gets first
access to the event, passing to inner objects if not handled) or
"innermost out" (lowest container gets first access, passing up if not
handled). I've been assuming "outermost in", but can't find confirmation
of this in any documentation.
- even with "enableEvents(AWTEvent.MOUSE_EVENT_MASK) called from the
PageGroup object, I'm not getting mouseclicks.
Any help in getting this working would be greatly appreciated!!
Thanks in advance,
Frank Alviani
- Next message: Andrew Thompson: "Re: How to assign a string buffer to a JEditorPane"
- Previous message: Martin Unzner: "How to assign a string buffer to a JEditorPane"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]