The JavaSM Developer
ConnectionSM (JDC) presents a Short Course
on Effective Layout Management written by JavaTM Software licensee, the
MageLang Institute. A leading provider of Java technology training, MageLang
has contributed regularly to the JDC since 1996.
The MageLang Institute, since its founding in 1995, has been dedicated
to promoting the growth of the Java technology community by providing
excellent education and acting as an independent resource. To find out
more about MageLang's Java technology training, visit the MageLang
web site.
The goal of this course is to help you effectively use layout managers with
AWT and Java Foundation Classes (JFC) Project Swing components. You will
learn how to build complex screens with the help of one or multiple layout
managers.
Because of the promise of Write Once, Run AnywhereTM (WORA) with the Java
platform, development of Graphical User Interfaces (GUI) with the Abstract
Window Toolkit (AWT) is not straightforward. Unlike when creating user
interfaces for one language on one platform, you cannot just position
components with absolute sizes and coordinates. You must take into account
the fact that components are different sizes on different operating systems.
You also must take into account what happens to those components when you
internationalize an application and the text labels are localized, as some
labels may be different lengths. Additionally, you need to properly handle
what happens if the user resizes the user interface screen. To deal with all
these situations, the Java platform has the concept of a layout manager for
positioning components within windows.
A general familiarity with the Abstract Window Toolkit (AWT) and/or JFC
Project Swing components is assumed. If you are not familiar with these
capabilities, see the earlier
Fundamentals
of Java Swing, Part I tutorial.
These course notes and exercises require a JDKTM 1.1.5 or higher
environment.
About the Author
Scott Stanchfield is a Software Mage with MageLang Institute. He is a strong
advocate of layout manager use, hunting developers who use absolute positioning
for sport. He recently developed and is teaching courses on advanced features
of VisualAge for Java, and maintains the
VisualAge
for Java Tips and Tricks resource. His new book,
Effective VisualAge for Java will be published
by Wiley late summer 1999.
Reader Feedback
Tell us what you think of this article.
Copyright © 1998-1999
MageLang Institute.
All Rights Reserved.