Why does getPreferredSize() return (0,0) for my frame? (Or why does pack() crunch my frame to nothing?)

Scott Stanchfield

This happens if you don't have a layout manager set for the components inside the frame.

If you use appropriate layout managers, you should see decent results from pack().

For details on using layout managers, see http://developer.java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/index.html

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact