• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with getPreferredSize()

 
Ranch Hand
Posts: 171
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic