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.
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.
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
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.
Hi, A.The weightx & weighty should have values between 0.0 & 1.0 Good call Herbert. I missed the sneaky wordshould. This word makes the statement false. I knew that it could take %ages also. Thanks Ajay Kumar
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: