Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2006

Tip: Looking for answers? Try searching our database.

pack() on a JInternalFrame with BorderLayout does not size components

Thread view: 
dmcrane@gmail.com - 20 Mar 2006 16:55 GMT
I need to get the size of a component that is added as CENTER. This
works on a JFrame but not an internal frame. I thought pack() would
handle this but the size remains zero. I do not want to hard code the
size of my center component. How can I make the layout manager size
this component?
dmcrane@gmail.com - 20 Mar 2006 21:06 GMT
Apparently, pack does nothing until the internal frame is added to the
desktop pane. I passed the desktop pane into the constructor and had it
add itself to the desktop pane.
Then, pack works. wow, what a pain in the arse!
Oliver Wong - 20 Mar 2006 21:50 GMT
> Apparently, pack does nothing until the internal frame is added to the
> desktop pane. I passed the desktop pane into the constructor and had it
> add itself to the desktop pane.
> Then, pack works. wow, what a pain in the arse!

   Usually you call pack() after all the components have been added, to let
the LayoutManager know "Okay, go ahead and actually lay the components out;
I'm done messing around." If you call pack() too early, some of the
assumptions that the layout manager is going to make will turn out to be
false, and you'll get weird results.

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.