0% found this document useful (0 votes)
1K views3 pages

Program-3.2: //write Java Program To Demonstrate Grid of 5 5

This Java program demonstrates a 5x5 grid layout by creating an applet with a GridLayout of 5 rows and 2 columns. It initializes the layout, creates 10 button objects labeled A through J, and adds each button to the grid layout. When run, the applet will display the buttons in a 5x5 grid.

Uploaded by

rohitchavan2345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views3 pages

Program-3.2: //write Java Program To Demonstrate Grid of 5 5

This Java program demonstrates a 5x5 grid layout by creating an applet with a GridLayout of 5 rows and 2 columns. It initializes the layout, creates 10 button objects labeled A through J, and adds each button to the grid layout. When run, the applet will display the buttons in a 5x5 grid.

Uploaded by

rohitchavan2345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

program-3.

2
//Write java Program to demonstrate grid of 5*5
import java.awt.*;
import java.applet.*;
public class GridLayout_Demo1 extends Applet
{
GridLayout g;
Button
b0,b1,b2,b3,b4,b5,b6,b7,b8,b9;
public void init()
{

g=new
GridLayout(5,2);
setLayout(g);
b0=new
Button("A");
b1=new
Button("B");
b2=new
Button("C");
b3=new
Button("D");
b4=new
Button("E");
b5=new
Button("F");
b6=new
Button("G");
b7=new
Button("H");
b8=new
Button("I");
b9=new
Button("J");
add(b0);
add(b1);
add(b2);
add(b3);
add(b4);
add(b5);
add(b6);
add(b7);
add(b8);
add(b9);

/*<applet
code="GridLayout_Demo1.class
" width=300
height=300></applet>*/

You might also like