Program to create Buttons,TextArea and Border using Applet

    

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

public class Border1 extends Applet
{
  LayoutManager Layout;
  Button [] buttons;

  public Border1 ()
  {
    int i;

    Layout = new BorderLayout (10,10);
    setLayout (Layout);

    buttons = new Button [4];
    TextArea ta=new TextArea();

    for (i = 0; i < 4; i++) {
      buttons[i] = new Button ();
      buttons[i].setLabel ("Button " + (i + 1));
    }

    add (ta, BorderLayout.CENTER);
    add (buttons[0], BorderLayout.NORTH);
    add (buttons[1], BorderLayout.SOUTH);
    add (buttons[2], BorderLayout.EAST);
    add (buttons[3], BorderLayout.WEST);
}
}

/*Applet code*/
<html>
<head>
<title>Hello Applet</title>
</head>

<body>
<applet CODE="Border1.class" WIDTH=820 HEIGHT=500>
</applet>

</body>
</html>

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|