// Border Layout
import java.awt.*;
import java.awt.event.*;
public class bord extends Frame
{
Button b1,b2;
Label l1,l2;
TextField t1;
bord()
{
setLayout(new BorderLayout());
b1 = new Button("one");
b2 = new Button("two");
l1 = new Label("Name : ");
l2 = new Label("Place : ");
t1 = new TextField();
add(b1,BorderLayout.NORTH);
add(b2,BorderLayout.SOUTH);
add(l1,BorderLayout.WEST);
add(l2,BorderLayout.EAST);
add(t1,BorderLayout.CENTER);
addWindowListener(new w());
setSize(200,200);
setVisible(true);
}
class w extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
public static void main(String arg[])
{
bord ff = new bord();
// ff.show();
// ff.setBounds(0,0,300,300);
}
}
Java
Java - Border 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.
