What is the different between size and preferred size?

I found the size and preferred size of a same component is different. Which one can I use?
[97 byte] By [youhaodiyia] at [2007-11-27 10:02:09]
# 1

if(the parent container's layoutManager is null)

{

size

}

else

{

preferredSize

}

Michael_Dunna at 2007-7-13 0:36:21 > top of Java-index,Desktop,Core GUI APIs...
# 2
How about the root container? It doesn't have a parent container.
youhaodiyia at 2007-7-13 0:36:21 > top of Java-index,Desktop,Core GUI APIs...
# 3

> Which one can I use?

For what?

The preferred, minimum and maximum sizes are used by the layout manager as suggestions to determine the size of a component based on the rules of the layout manager. The layout manager will then set the size of the component.

When a component is painted, it is always painted at its size.

camickra at 2007-7-13 0:36:21 > top of Java-index,Desktop,Core GUI APIs...