Creating GridLayout using Applet and AWT

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

public class Grid1 extends Applet {
  LayoutManager Layout;
  Button [] Buttons;

  public Grid1 () {
    int i;
   
    Layout = new GridLayout (3, 2);
    setLayout (Layout);
   
    Buttons = new Button [5];
    for (i = 0; i < 5; ++i) {
      Buttons[i] = new Button ();
      Buttons[i].setLabel ("Button " + (i + 1));
      add (Buttons[i]);
    }
  }

}

0 comments:

Post a Comment

 
 
 
 


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