I have been baffled by the following questions for a while: 1. What containers can have Menu? In several different occasions, I have seen different answers. In RHE's book, it is said that only Frame can have Menu. However, in another occasion (forgot the name of the book I read), it is said that all these containers (Applet, Window, Panel) can have Menu. 2. What determine whether a container can have Menu or not? Thanks! Sam
Joined: Oct 02, 2000
My understanding is that only Frame can have menu components. However, for PopupMenu, you can add it to almost all the containers. Any correction on that?
Joined: Aug 30, 2000
Hi Sam, Adrian ... I'm fairly certain Adrian is right. The Class Libraries state
The only valid parent for a MenuBar is a Frame instance.
And since Menu objects can only be inserted in MenuBar's; you can only build a Menu in a Frame. On the other hand, a Pop-up Menu can be added to any component. Hope that helps.
------------------ Jane The cure for boredom is curiosity. There is no cure for curiosity. -- Dorothy Parker
Adrian and Jane, Thanks! One more question: If only Frame can have Menu, then why all those containers (Panel, Applet, Frame, etc) all implement MenuContainer interface? What is this MenuContainer used for? Thanks again! Sam