// Flow Layout
import java.awt.*;
import java.awt.event.*;
public class flow extends Frame
{
Button b1,b2,b3,b4;
flow()
{
setLayout(new FlowLayout());
// setLayout(new FlowLayout(FlowLayout.LEFT));
// setLayout(new FlowLayout(FlowLayout.RIGHT));
b1 = new Button("one");
b2 = new Button("two");
b3 = new Button("three");
b4 = new Button("four");
add(b1); add(b2); add(b3); add(b4);
addWindowListener(new w());
}
class w extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
public static void main(String arg[])
{
flow ff = new flow();
ff.show();
ff.setBounds(0,0,300,300);
}
}Java
Java - Flow Layout using Frame Demo

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
