Thursday, November 15, 2012

Java Exercise #53: Demonstrate Border Layout

The BorderLayout manager divides the window into five areas - East, West, South, North and Center. Components can be added to the container using BorderLayout by using add method with the index as parameter. Index is a constant from BorderLayout.EAST, BorderLayout.WEST, BorderLayout.SOUTH, BorderLayout.NORTH or BorderLayout.CENTER

The components are laid out according to their preferred sizes where they are placed. The North and South components can stretch horizontally, East and West can stretch vertically and Center can stretch bothways.

Exercise: Write a program that demonstrates BorderLayout.

Download Code: Border Layout

No comments:

Post a Comment