This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi. I am having a problem laying out a gui. I want to place five buttons and five labels on a panel. I want the button to have a corresponding label. I can do this with Grid Layout. However, I want the buttons to be small. Grid Layout will not let me set the size of the buttons. What would be the best way of going about this? I'm pretty new with layout managers so bear with me (I was using visual age before to do GUI!). Thanks a million!
Null layouts totally loose out on the dynamic resize features of layout managers. I have never worked on UI code that at some point did not need some kind of modification. If you hard code every position and size on your screen, you have a TON of extra work to add a button here or a combo box there. Don't use null layouts. Learn to harness the power of LayoutManager!!!
Joined: May 17, 2001
I have yet to see a UI that has to use the null layout. Once you use it, you also have to set the resizing of your window to off. If you don't, you have to place a great deal of code into your app just to make it appear proportional to where you started. The Layout Managers provide all of this functionality for you. The argument has been made many times in this forum against the use of null layout. It is a broken record. The difference between the null layout and the others is that it takes time to learn the other layouts and how they can be combined to do whatever you want. We can also talk about adding new components to an existing layout. Using the null all components need to be repositioned manually. With the other layout managers you may just need to add the component. If you need more argements against the use of null layout, just search this forum. There are plenty against. Now why don't you provide an argument for their use.