Week 8, Containers and LayoutManagers

LayoutManagers

One of the questions I was asked back in Lecture 6 was whether it was possible to position components, that is to decide where a component goes when it's added to an applet. The answer is yes; you can decide where to place a component.

The LayoutManager class lets you control the locations of individual widgets in Java applets. Since you're never sure how big an area you'll have to work with or how it will be shaped, most of the controls are relative in nature. That is you say this widget should be above that one or left aligned with the other one; but you don't say that this widget's upper left hand corner is at pixel (42, 65).

This week you'll learn the five basic layout managers included in the AWT and some additional tricks for handling complicated applets.

Containers


Start | Top
Last Modified June 30, 1998
Copyright 1997, 1998 Elliotte Rusty Harold
elharo@metalab.unc.edu