Monday, May 4, 2020

Border Layout - Layout Managers

import java.awt.*;
import java.awt.event.*;
class  Border extends Frame
{
Border(String s)
{
super(s);
setSize(300,140);
setLayout(new BorderLayout());

add(new Button("North"),BorderLayout.NORTH);
add(new Button("East"),BorderLayout.EAST);
add(new Button("South"),BorderLayout.SOUTH);
add(new Button("West"),BorderLayout.WEST);
        add(new Button("Center"),BorderLayout.CENTER);
setVisible(true);
setSize(300,300);
addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) {
                System.exit(0);
            } });

} }
class Test4
{
public static void main(String[] args)
{
Border  f= new Border("Border Layout");
} }

No comments:

Post a Comment