by Daeron Meyer
Note: requires Netscape 2.0b3 or higher.
What's a LayoutManager?
Layout managers in the Java/AWT toolkit define how Components such as Buttons, Scrollbars or TextAreas are positioned with respect to each other inside Container objects, like Panels or Frames. Since Components can have different sizes across different platforms because of changes in the underlying toolkit (X11/Motif vs. Windows), or changes in font size, it's important to have a LayoutManager to keep Components positioned so that they look nice, and so that no overlaps can occur. Also, when a Container is resized (by the user or the program), it is important to have the Components in that Container also be resized and repositioned in an elegant way.
What LayoutManager classes already exist in AWT?
BorderLayout, CardLayout, FlowLayout, GridBagLayout and GridLayout are the layout managers that come as part of the frozen Beta Java API.
Why make another LayoutManager?
Unfortunately, I found the default LayoutManager classes that come with AWT to be either too difficult to use, too buggy, or too weak for the purposes of building a high quality, complex, user interface. Sure, you can write extremely simple applets with the default LayoutManagers, but when it came time to make a *real* applet, I decided I needed something that was more powerful, more time tested. The result was the PackerLayout class. I derived the behavior of the PackerLayout class from the Tk packer, a widget geometry manager which had already seen much use under Tcl/Tk.
How do I use PackerLayout?
Here are some examples of PackerLayout in action. All examples include source code so you can see what's going on behind the scenes:
How do I get PackerLayout?
Assuming you already have the JDK (java development kit) from sun, just download the following java source code and compile it with "javac". Then you'll have a working PackerLayout class!
Check out some of my other java apps too, if you're interested...