Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Focus problem...



Hi,
I want to dynamically change the application menu depending on which
panel is seleted inside a split pane.

My application, has following things :
1) main frame - a JFrame derived class,
2) a single JSplitPane inside the main frame
3) Two panels (horizontally separated) inside the split pane -left panel
and right panel.
4) any number of children (at any depth) in these two panels.
What I want to do is, when the user clicks anywhere inside the left
panel, I want to change the main frame's menu bar items (or sub menus).
Also, when the user clicks anywhere inside the right panel, I want to
change the menu accordingly.
Thus, I want to know when the panel as a whole 'gets focus' (I cannot
use the term 'gets activated' because, I suppose it is used in context
of Frames and internal frames), though actually a child deep inside the
panel has got the actual focus.
I tried registering a FocusListener with both the panels, but it doesn't
work even when I click on the panel itself - and not on any of it's
children.
I tried registering a mouse listener with both the panels, but
(obviously) that too doesn't work because, the mouse 'press' or 'click'
is generated on the actual (possibly a child) component instead of the
panel itself.

Is there an easy way to accomplish something like he wanted? I mean a
way of detecting of one of the child components of a certain JPanel gets
the focus?
----------------------------------------------------------------------------
--------------
Les informations ou pieces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressement vise peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La societe Ouest-France decline en
outre, toute responsabilite de quelque nature que ce soit au titre de ce
message s'il a ete altere, deforme ou falsifie.
----------------------------------------------------------------------------
--------------
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.