• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

AWT

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Attemping to compile and run the above code

1.Will cause a compilation error - a Layout cannot be set after a component has been added with a preset Layout Manager.
2.Will cause a Runtime Exception - a Layout cannot be set after a component has been added with a preset Layout Manager.
3.Will compile cleanly and throw no runtime Exception. Only the button with label "Center" is visible and occupies the whole screen.
4.Will compile cleanly an throw no runtime Exception. All the buttons are arranged in a single line. Any other component added in future will follow the rules of the BorderLayout Manager.
5.Will compile and run cleanly, but no component is visible.
6.Will compile cleanly and throw no runtime Exception. The buttons are arranged as listed below
Button Label Position
Center Center
North North
South South
East East
West West
ans is 5, why the component is not displayed?
-Arun
 
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BorderLayout and CardLayout are the uniques AWT LayoutManagers that don't know how to rearrange components previously added.
reply
    Bookmark Topic Watch Topic
  • New Topic