Login    New User    Forgot Password    Help      

Border Layout

Java Tutorials

Example

// Border Layout
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="control10" width=250 height=300>

</applet>
*/

public class control10 extends Applet

{

public void init()

{
setLayout (new BorderLayout ());
add(new Button("Top of the Program"), BorderLayout.NORTH);
add(new Label("Footer message"), BorderLayout.SOUTH);
add(new Button("Right"),BorderLayout.WEST);
String str= "This is First line in java text field \n"+
"This is Second line in java text field \n"+
"This is third line in java text field \n"+
"This is Last line in java text field";
add(new TextArea(str),BorderLayout.CENTER);
}
}

Output

Output in Applet

Java Tutorials