diff b/w setMaximumSize and setBounds
what is the difference b/w using setMaximumSize
and setBounds...
what is the difference b/w using setMaximumSize
and setBounds...
and could u also tell if we could change the vgap b/w its two components in boxLayout
> what is the difference b/w using setMaximumSize and setBounds...
They are not related at all.
Before a component can be painted, it must have a size and location (or you can specify both by using set bounds).
If you don't use a layout manager, then you are responsible for setting those two values so the component is painted correctly.
If you use a layout manager, then the preferred, minimum and maximum sizes are "suggestions" to be used by the layout manager. Once the layout manager considers all the suggestion it will then set the size and location for you so you don't have to worry about it.
Read the Swing tutorial on "Using Layout Managers" for more information.
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
The section on BoxLayout will show you how to get vertical spacing.