Border Layout in Applet

//<applet code=BorderLayoutDemo height=500 width=500></applet>
// example of BorderLayout
import java.awt.*;
import javax.swing.*;

public class BorderLayoutDemo extends JApplet {
	JPanel p1;
	JButton b1, b2, b3, b4, b5;
	BorderLayout bl;

	@Override
	public void init() {
		p1 = new JPanel();
		b1 = new JButton("button1");
		b2 = new JButton("button2");
		b3 = new JButton("button3");
		b4 = new JButton("button4");
		b5 = new JButton("button5");
		// bl=new BorderLayout();
		bl = new BorderLayout(20, 40);
		p1.setLayout(bl);
		getContentPane().add(p1);
		p1.add("North", b1);
		p1.add("South", b2);
		p1.add("West", b3);
		p1.add("East", b4);
		p1.add("Center", b5);
	}
}

Download

Layout Manager in Java

Border Layout
Box Layout
Card Layout
Flow Layout
Gridbag Layout
Gridbag Layout
Grid Layout
Design GUI contianer without layout


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code