mark,
please post your question here instead of sending private messages so that everybody can benefit
i had meant that we know that classes which inherit under the heirarchy
of MenuComponents like Menu, MenuItem etc cannot be added to Components
as their heirarchy is different.
fine, but then suddenly there are exceptions like MenuBar can be added to
Frame, or PopMemu can be added to any Component. so can you tell me what
interface or which method they have or implement or what is it that makes
them apart.
i hope u got my point. I have drawn two heirarchy digrams one for
Component and the other for MenuComponent and the special conditions for
MenuBar and PopupMenu is bothering me. In the sense that i want to why ?
You are right there are two distinct hierarchies, one for Components and one for MenuComponents.
A MenuBar can only be added to a Frame because only that class has a setMenuBar method taking a MenuBar as argument.
PopupMenu can be added to any Component.
From
Java AWT: Popup Menu
...
Popup menus can be attached-to/removed-from any component, using the methods in class java.awt.Component:
-add(PopupMenu popup)
-remove(MenuComponent popup)
Note that a popup menu can only be owned by one component at a time.
...
I hope that helps clear your doubt...