• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Gridbag layout

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Choose the correct statement about gridbag layout:
A.The weightx & weighty should have values between 0.0 & 1.0
B.If you specify the fill field is BOTH, there is no meaning to set anchor
field
C.If you specify anchor field there is no meaning to set fill field is BOTH
I think only B is true. Please confirm this.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sree,
A is also correct. The weightx and weighty values should range between 0.0 and 1.0.
regds
Ajay
 
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I agree with you Sree. C is definately incorrect, but may be A is the catch. But I chose to consider weightx and weighty as percentages whose actual values can be resolved at runtime. Thus, the actual weightx value for a cell will be its proportion over the total of the weightx values in that row, meanung that it can be any value. Is this not tight ?
Herbert.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sree:
a previous discussion on the same qstn.
it has some comments by maha ...check this out. http://www.javaranch.com/ubb/Forum24/HTML/001253.html
And, btw, if I am right I think you are planning to
give the exam really soon....a week maybe....
all the best.
Regds.
- satya
 
Herbert Maosa
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ajay,
Weightx and Weighty can have any value. You should consider them as proportions. Imagine that in your grid, you have three button in a row, called one , two, and three. Then you can legally set the weightx values for the three buttons respectively as 20,30, and 50. The compiler will not complain. All what this means is that at run time, the total value of the weightx values will be computed for that row( which is 100). Then the actual value of the weightx will be determined as a proportion of this value, thus for button button one it will be (20/100 = 0.2), for button two it will be ( 30/100 = 0.3) and for button three it will be (50/100 = 0.5).
You might want to write a small piece of code to convince yourself that the compiler will not balk for setting weightx values to 20,30,50 or any value. If it does, please let me know
Herbert.
 
Ajay Kumar
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
A.The weightx & weighty should have values between 0.0 & 1.0
Good call Herbert. I missed the sneaky word should. This word makes the statement false. I knew that it could take %ages also.
Thanks
Ajay Kumar
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your answer is correct sree. only B is correct. Today is 16 th right? If I can ask, is it today your special day?
regds
maha anna
 
sreelakshmi sarma
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all for your responses. Actually i scheduled my test for today. But had to postpone that due to personal reasons. But will be giving by the end of this week. I want to finish this asap tired of cramming basics.

Thank you very much.
 
machines help you to do more, but experience less. Experience this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic