What is the use of setPreferredSize() method for components?
Created May 4, 2012
You should never use this method!!!
The preferred size of a component should always be computed. This size information is based on several factors, including (but not limited to)
Note that getPreferredSize() will only be called by certain layout managers. If a component is not appearing the proper size, make sure all containers above it (that contain it) are using a layout manager.
For more details on layout management and the effect of preferred size, please see my article "Effective Layout Management" at http://java.sun.com/jdc/onlineTraining/GUI/AWTLayoutMgr/