• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AWT

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question is
which of the following cannot be added to a container?
1.applet
2.panel
3.frame
4.window
5.component
6.container

i think its container, but the ans says frame.. i am not sure if the ans is right. pl explain
thanx
vidhya
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is an answer from the FAQ at javaranch


What can be added to a container?
Answer: Provided by Mapraputa Is
Although the add() method defined in Container class has signature add(Component comp), not all components or Component descendants can be added.
According to the code of add() method, an IllegalArgumentException will be thrown as a result of an attempt to add:
this container's parents
an object which is an instance of Window (including all its descendants, such as Frame or Dialog)


Hope this helps

 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it mean that Window, frame and Dialog can not be added to a container?
--Farooq
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, Window, frame and Dialog are top-level container and cannot be added to other component.
Guoqiao

Originally posted by Muhammad Farooq:
Does it mean that Window, frame and Dialog can not be added to a container?
--Farooq


 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the answer of the question are 2,3.
right??
----------------
Liao
 
Ranch Hand
Posts: 2378
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Then the answer should be 3,4. What does 6 means...parent container of current container? And what abt 1 (applet)? Can we add an Applet to a Frame? How?

------------------
azaman
reply
    Bookmark Topic Watch Topic
  • New Topic