- Java Table of contents
- 2nd Java Cup
- Pie Chart I
- Pie/Bar Chart IB
- Pie/Bar Chart II
- Pie/Bar Chart III
- A Basic Calculator
- Linked Lists
- Linked List II
- Linked List III
- Linked List IV
- Hardware Store I
- Hardware Store II
- Hardware Store III
- Client/Server II
- Client/Server III
- Client/Server IV
- Multithreaded Client/Server
- Multithreaded Client/Server II
- Multithreaded Client/Server III
- Basic Calculator II
- Basic Calculator III
BorderLayout Manager code/source/resources
The purpose of this tutorial is to introduce you to the concept of the BorderLayout manager. The BorderLayout manager implements the LayoutManager Interface.
The BorderLayout manager is the default layout manager for JFrames.
The BorderLayout is able to place components in five areas: "North", "South", "East", "West" and "Center".
When you enlarge a container the center area grabs as much of the new space as possible.
Each area displays one component (which could be another container such as a JPanel).
If nothing is added to an outer area, meaning that they take up no space, then other areas with components will expand to fill the void.
BorderLayout is good for maintaining a row of buttons in one of the areas near the edges.
BorderLayout has two constructors:
- BorderLayout() - Constructs a new border layout with no gaps between components.
- BorderLayout(int hgap, int vgap) - Constructs a border layout with the specified gaps between components.
|Figure 1: Class BorderLayout
|Figure 2: BorderLayout example
- A Basic Calculator I - demonstrates how the BorderLayout Manager arranges buttons for a calculator pad.
- A Basic Calculator II - demonstrates how the BorderLayout Manager arranges buttons for a calculator pad.
- A Basic Calculator III - demonstrates how the BorderLayout Manager arranges buttons for a calculator pad.
- Uses multiple layout manager to initialize and sort an array.
- This example demonstrates how to use various layout managers - Various Layout Managers Demo