diff b/w setMaximumSize and setBounds

what is the difference b/w using setMaximumSize

and setBounds...

[77 byte] By [shagya] at [2007-11-27 10:25:43]
# 1

and could u also tell if we could change the vgap b/w its two components in boxLayout

shagya at 2007-7-28 17:35:16 > top of Java-index,Desktop,Core GUI APIs...
# 2

> 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.

camickra at 2007-7-28 17:35:16 > top of Java-index,Desktop,Core GUI APIs...