Java Code

import javax.swing.*;
public class BoxLayoutEx extends JApplet
{
    JButton one, two, three;

    public void init( )
    {
    	one = new JButton( "one" );
    	two = new JButton( "two" );
    	three = new JButton( "buckle my shoe" );

		setLayout( new BoxLayout( getContentPane( ), BoxLayout.Y_AXIS ) );
		add( one );
		add( two );
		add( three );
    }
}

Back to Code Examples
©2006- by E.S.Boese. All Rights Reserved