Java Reference
In-Depth Information
Display 17.7
The BorderLayout Manager (part 2 of 2)
This is the file BorderLayoutDemo java .
1 public class BorderLayoutDemo
2 {
3 public static void main(String[] args)
4 {
5 BorderLayoutJFrame gui = new BorderLayoutJFrame();
6 gui.setVisible( true );
7 }
8 }
R ESULTING GUI
First label
Third label
Second label
A BorderLayout manager places labels (or other components) into the five
regions BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST,
BorderLayout.WEST , and BorderLayout.CENTER . These five regions are arranged as
shown in Display 17.8. The outside box represents the JFrame (or other container to
which you will add things). None of the lines in the diagram will be visible unless you
do something to make them visible. We drew them in to show you where each region
is located.
Search WWH ::




Custom Search