File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT / JFace and the fly likes Help with getPreferredSize() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "Help with getPreferredSize()" Watch "Help with getPreferredSize()" New topic
Author

Help with getPreferredSize()

Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 167
I need some help. I am writing a fractal generator. The main window has a BorderLayout with some controls in the NORTH and SOUTH fields. The CENTER field has a Canvas component with a preferred size.
The problem is, how do I calculate the correct size of the containing Frame? If I call getPreferredSize() on the NORTH and SOUTH components from the Frame constructor, it is returning zero. I think this is because they haven't been initialized ?
More generally, I don't understand the process of initialization of AWT components. Can somebody please explain to me in general how getPreferredSize() works, how it is used by the LayoutManager, etc? Thanks..


Sun Certified Programmer for the Java 2 Platform
 
 
subject: Help with getPreferredSize()
 
Threads others viewed
BorderLayout Clarification
another layout mock question
Layout Manager
BorderLayout
BorderLayout...
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com