Professional Documents
Culture Documents
A 0046 Adj Fifth
A 0046 Adj Fifth
Experiment No. 05
Title of Experiment Write a program to demonstrate grid of 5*5.
Resources Required JDK 10.0.2
Objectives To check the output of Grid Layout with 25 Buttons.
Program
import java.awt.*;
import java.applet.*;
/*
<applet code="GridLayoutPar" width=300 height=200>
</applet>
*/
public class GridLayoutPar extends Applet
{
static final int n = 5;
public void init()
{
setLayout(new GridLayout(n, n));
setFont(new Font("Calibri", Font.BOLD, 13));
for(int i = 0; i < n; i++)
{
for(int j = 1; j < 6; j++)
{
int k = i * n + j;
if(k > 0)
add(new Button("" + k));
}
}
Button b8=new Button("ABHISHEK WAGHRE 18203A0046");
add(b8);
}
}
Output