Advanced JAVA Laboratory Manual by Patel Gayatri
Author:Patel, Gayatri [Patel, Gayatri]
Language: eng
Format: azw3, pdf
Publisher: Osmora Inc.
Published: 2016-01-29T16:00:00+00:00
BorderLayout
The BorderLayout class implements a common layout style for top-level windows. It has four narrow, fixed-width components at the edges and one large area in the center. The four sides are referred to as north, south, east, and west. The middle area is called the center. Here are the constructors defined by BorderLayout:
BorderLayout( );
BorderLayout(int horz, int vert);
The first form creates a default border layout. The second allows us to specify the horizontal and vertical space left between components in horz and vert, respectively. BorderLayout defines the following constants that specify the regions:
BorderLayout.CENTER
BorderLayout.SOUTH
BorderLayout.EAST
BorderLayout.WEST
BorderLayout.NORTH
When adding components, we will use these constants with the following form of add( ), which is defined by Container:
void add(Component compObj, Object region);
Here, compObj is the component to be added, and region specifies where the component will be added. Here is an example of a BorderLayout with a component in each layout area:
// BorderLayoutDemo.java
import java.awt.*; import java.applet.*;
/*
<applet code=“BorderLayoutDemo” width=400 height=200>
</applet>
*/
public class BorderLayoutDemo extends Applet
{
public void init()
{
setLayout(new BorderLayout());
add(new Button(“This is across the top.”), BorderLayout.NORTH);
add(new Label(“The footer message might go here.”), BorderLayout.SOUTH);
add(new Button(“Right”), BorderLayout.EAST);
add(new Button(“Left”), BorderLayout.WEST);
String msg = “The reasonable man adapts ” +
“himself to the world;\n” +
“the unreasonable one persists in ” + “trying to adapt the world to himself.\n” + “Therefore all progress depends ” +
“on the unreasonable man.\n\n” +
” - George Bernard Shaw\n\n”;
add(new TextArea(msg),
BorderLayout.CENTER);
}
}
Output:
Download
Advanced JAVA Laboratory Manual by Patel Gayatri.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(15032)
The Mikado Method by Ola Ellnestam Daniel Brolund(12292)
Hello! Python by Anthony Briggs(12183)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(11550)
Dependency Injection in .NET by Mark Seemann(11336)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10530)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(10150)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(9811)
Grails in Action by Glen Smith Peter Ledbrook(9479)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(9045)
Hit Refresh by Satya Nadella(9039)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(9032)
The Kubernetes Operator Framework Book by Michael Dame(8473)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(8437)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8298)
Robo-Advisor with Python by Aki Ranin(8252)
Practical Computer Architecture with Python and ARM by Alan Clements(8225)
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(8193)
Building Low Latency Applications with C++ by Sourav Ghosh(8099)