• Post Reply Bookmark Topic Watch Topic
  • New Topic

Layout Managers  RSS feed

 
nupur dhawan
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JPanels and Applets have FlowLayout as their default Layouts and Frames have BorderLayout as their default Layout .
Please correct me if i am wrong .
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possibly the best answer to your question is found by writing a quick test program.
 
Uwais Shah
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are absolutely right!!!
 
nupur dhawan
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason i ask about this is the statement i came across while studying from a chapter in 'Thinking in Java' by Bruce Eckel :
'. The default layout is used, since JApplet defaults to BorderLayout:'

 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nupur,
If you were to write a quick test applet (using JApplet) you'd quickly discover the correct answer. Also, check the API documentation for JApplet at: http://java.sun.com/j2se/1.4/docs/api/javax/swing/JApplet.html .
I strongly suggest that you check the documentation and/or write a quick test program for questions of this nature. Anybody here could accidentally answer the question incorrectly. A test program will seldom lie.
With a JApplet, you don't add components directly to the applet (as you do with an Applet). Instead, you have to add the components to the content pane of a JApplet. The default layout of this content pane is in fact BorderLayout.
Don't take my word for it. I may have made a mistake.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
uwais,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!