is setBound()
the best way for setting the position of GUI? What are the other option and each own strength over the other? tnx
How can I improve my knowledge in positioning components in java?
65 views Asked by gihooh AtThere are 3 answers
Setting GUI elements by hand (absolute positioning) will cause nightmares if you ever try to modify anything in the future, and especially with different sized monitors. Look at the different layout managers that Swing/AWT offers, and utilize them to your advantage, and even combine multiple layouts to create the one you need (eg. flow layout inside a grid layout, which is in the east portion of a border layout).
**No...**
setBound() is not the best way to position your components. Because if you plan to change something in the future then you will not able to do this just like that or you have to change all the thing related to that component.
The best way to position your components is that use of Layout Managers. So try to use proper layout manager to position your components, so that it will not trouble you in the future
Many here (myself included) feel that it's the worst way to do this as it leads you to create GUI's that are rigid, difficult to maintain and upgrade and look terrible on most platforms other than the one it was developed on.
Check out the Swing layout manager tutorials and use the layout managers: Lesson: Laying Out Components Within a Container