Create a Frame having
      · Border layout
      · Set the visiblity as true
      · Set the size as (400,400)
      · Also put the TextArea into it
      · Along with the area put Button named “Header”,”Footer”,”Right”,”Left”.
      · Set the button as the following “Header” button on north side, “Footer” Buttton
        on “South” side, “Right” button on East side, and “Left” button on West side.
      · And in the centre set the text area defined above.


import java.awt.*;
import java.applet.*;

public class BorderLayoutDemo extends Frame{
    Button b1, b2,b3,b4;
    TextArea t;
    BorderLayoutDemo(){
        setVisible(true);
        setSize(400,400);
        BorderLayout b = new BorderLayout();
        setLayout(b);
        t = new TextArea();
        b1 = new Button("Header");
        b2 = new Button("Footer");
        b3 = new Button("Right");
        b4 = new Button("Left");
        add("North",b1);
        add(b2,BorderLayout.SOUTH);
        add(b3,BorderLayout.EAST);
        add(b4,"West");
        add("Center",t);
    }   
    public static void main(String args[])
    {
        BorderLayoutDemo ob = new BorderLayoutDemo();
    }
}

0 comments:

Post a Comment

Digital Marketing

Subscribe to RSS Feed Follow me on Twitter!