Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Border Layout

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.Border Layout never honours preferred size of component. //TRUE
2.Border Layout always honours preferred height of component. //FALSE
This is what is given is Ashok Java Applet.
I think it should be other way round ie. FALSE for 1 and TRUE for 2, as BorderLayout honours preferred height in N-S and width is E-W.
Someone pls clarify.
Deepali
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You wrote "as BorderLayout honours preferred height in N-S and width is E-W."
I agree w/you w/that...
"The East and West regions are the opposite of North and South: In E and W, a component gets to be its preffered width but has its height constrained."
This is from Complete Java 2 Certification Study Guide by M. Ernest
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My answer is that both are false. Q#1 isn't entirely true, as the East/West regions honor preferred width, although they ignore preferred height, for example. Q#2 is false for the same reason.
 
Deepali Pate
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But what abt the TRUE/FLASE??
 
Deepali Pate
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with u Paul i think also both are wrong.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What out ! What does "preferred size" mean ?
It means " Under any circumstances, the component's size specified by the programmer
will never change ".
Only FlowLayout honours a component's size even
when the hosting container's size changes.
The heights of the south and north components are fixed. That is true but don't mistake it with
"the programmer can specify the size and the size will never change".
You cannot PREFER to have a certain height for
the south and north components. You have no choice but to let the BorderLayout choose the
height for the south and north components.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Deepali Pate:
[QB]1.Border Layout never honours preferred size of component. //TRUE
2.Border Layout always honours preferred height of component. //FALSE
Deepali, in my opinion , both the answers are correct. The important words here are 'never ' and 'always '.
In 1 , the statement is true as , the components are placed in the frame as per their location irrespective of all their dimensions.The layout 'never ' honours the size of the components,for example if you have placed components in the North ans South , they take up the whole of the North and South, irrespective of their preferred width ,and the same goes for the components placed in the east and west , they take up the height available , not their preferred height .WHich also explains the second answer ...
In 2 , the statement is false as , the preferred height of the components is not 'always ' honoured.
I hope this is clear..

 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic