Setting FlowLayout Alignment

You can change the alignment of a FlowLayout in the constructor. Components are normally centered in an applet. You can make them left or right justified instead. To do this just pass one of the defined constants FlowLayout.LEFT, FlowLayout.RIGHT or FlowLayout.CENTER to the constructor, e.g.

    this.setLayout(new FlowLayout(FlowLayout.LEFT));
    this.setLayout(new FlowLayout(FlowLayout.RIGHT));
    this.setLayout(new FlowLayout(FlowLayout.CENTER));
Below you see all three variants:


Left Alignment


Center Alignment


Right Alignment


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