• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Menu?

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question:
True or False.
Menus can be added to containers.
my ans: true
but the ans from Jxam is false, beacuse:Menus can only be added to menu-bars.
for my understanding, any class can hold a menu as long as it implements MenuContainer Interface. Since Component implements MenuContainer, so menu can be added to containers.
 
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tony,
The answer is false. the reason is that
if u see the spec of Container class then all forms of the add() method of container class takes Component as a parameter.
but Menu is not a Component rather it is a MenuComponent. & u can't add a MenuComponent to a Container.
hope this helps
regards
deekasha


 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Tony,
I think the answer is false, since only components can be added to a container. Menu is not a subclass of a Component but by MenuComponent, there is no way you can add a menu to a container. But what you can do is add the menu to a menu bar then you can add this menu bar to a frame using setMenuBar() method of the frame. Hope this might help.
cheers!
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the question is a little bit ambiguous. The Container has a method inherited from Component add(PopupMenu). In terms of ineritance the PopupMenu is a Menu.
reply
    Bookmark Topic Watch Topic
  • New Topic