// FlowLayoutDemo3.java
// Demos FlowLayout alignments with an applet
// Uses three anonymous inner classes that each implements ActionListener
// APPLET CODE="FlowLayoutDemo3" HEIGHT=75 WIDTH=500
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class FlowLayoutDemo3 extends JApplet {
	private Container c;
	private JButton left, center, right;
	private FlowLayout flow;

	public void init( ) {
		c = getContentPane( );
		flow = new FlowLayout( );
		c.setLayout( flow );

		left = new JButton( "Left" );
		left.addActionListener(
			new ActionListener( ) {	// constructor
				public void actionPerformed( ActionEvent e ) {
					flow.setAlignment( FlowLayout.LEFT );
					flow.layoutContainer( c );
				}
			}
		);
		c.add( left );

		center = new JButton( "Center" );
		center.addActionListener(
			new ActionListener( ) {	// constructor
				public void actionPerformed( ActionEvent e ) {
					flow.setAlignment( FlowLayout.CENTER );
					flow.layoutContainer( c );
				}
			}
		);
		c.add( center );

		right = new JButton( "Right" );
		right.addActionListener(
			new ActionListener( ) {	// constructor
				public void actionPerformed( ActionEvent e ) {
					flow.setAlignment( FlowLayout.RIGHT );
					flow.layoutContainer( c );
				}
			}
		);
		c.add( right );
	}
}