Java Code



import javax.swing.*;
import java.awt.*;
public class FlowVertEx extends JApplet
{
    JButton one, two, three;
    FlowLayout flow = new FlowLayout( );
    JPanel pane = new JPanel( );

    public void init( )
    {
		one = new JButton( "one" );
		two = new JButton( "two" );
		three = new JButton( "three" );
		pane.add( one );
		pane.add( two );
		pane.add( three );
		add( pane );
    }
    public void start( )
    {
		flow.setVgap( (int )(this.getSize( ).getHeight( )/2) - (int )(one.getHeight( )/2) );
    	pane.setLayout( flow );
    }
}

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