• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JQuest: Panel & Window  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a container to hold six equal-sized button in the three columns of two. This arrangement must persist when the container is resized. Which of the following will create that container?
A. Canvas c=new Canvas(new GridLayout(2,3));
B. Panel p=new Panel(new GridLayout(2,3));
C. Window w=new Window(new GridLayout(2,3));
D. Panel p=new Panel(new GridLayout(3,2));
Obviously, A & D are wrong, since Canvas is not a subclass of container, and D creates a GridLayout with 3 rows, 2 columns.
But I don't know what's the difference here between B & C? Why the correct answer is B, not C? Thanks.
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because Window doesn't have a constructor that takes a LayoutManager.
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!