This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Does anybody has a tutorial or some kind of documentation about GridBagLayout more clear than the API documentation because I was reading it and I tried the code but when I began changing that code the behavior of the layout wasn�t the behavior I expected. I read that some settings of GridBagConstraints invalidate another settings, but I don�t understand the logic for some. The one I understand is: When you set fill = GridBagConstraints.BOTH then setting ipadx, ipady has no effect. Is there any past discussion about this topic? Thanks
AJ: I was trying the applet and it helped me a lot but I have the following doubts: weightx and weighty: Which are the valid asigns values and what do each value mean? gridwidth and gridheight: Which are the valid asigns values and what do each value mean? (except: RELATIVE & REMAINDER that I understand their meaning) gridx and gridy: don�t return the results I expect, is there any another variable that conflicts with this setting?
Joined: May 17, 2000
weightx and weighty - specifies how to handle the extra container space when the container is resized. try this: set the buttons ALL to weightx = 0 and weighty = 0. pick one button and set weightx and weighty to 1. Resize the container. What happens? what SHOULD happen is all the buttons stay the same size EXCEPT for the button you set to 1. what you just did is say 'ok - i want this ONE button to resize in both directions and none of the others'. now set your 1,1 button to .5,.5 and pick another button and set it to .5, .5. What do you expect to happen? gridwidth and gridheight essentially tells your component how big you want it to be. pick one button and change the gridwidth and gridheight to 1,1. what happens? now set it to 2,2. what happens? now 3,3....what you should see is that button getting bigger and bigger. gridx and gridy tell your component where you want it to live. pick button 10 and change gridx and gridy to 0,0. Does it disappear? Where do you think it is? It is probably sitting UNDER button 1. Change the size of button 10 and you might see it peeking out from underneath button 1. What you need to do when you play with this tutorial is set ALL of the buttons to be exactly the same settings. That way as you change a single setting you can see what happens and start to predict the behavior. Good luck. Let me know if you have more questions. I will be happy to try and help. Aj