File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes pack() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "pack() method" Watch "pack() method" New topic

pack() method

memati bas
Ranch Hand

Joined: Jan 29, 2006
Posts: 85
I could not understand entirely that what the purpose of pack method is in Frames ??
Would you please explain by giving example code snippet ?
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
It does the work to actually lay out all the components on the user interface, size them, and thus size the screen itself.

Just create a Swing application without calling pack() and see what happens.

jQuery in Action, 2nd edition
subject: pack() method
Similar Threads
pack() and validate()
how to increase the height of a JScrollpanes dynamically
JLabel centered in a JPanel
frame resize
Help,Components inside my Frame would not be displayed until maximized.