Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Program: Computer Engineering

Course : Advanced Java Programming Course Code: 22517


Semester: V Class: CO5IA
Laboratory No: Name of Subject Teacher: MEENAKSHI MAM
Name of Student: ABHISHEK WAGHRE Roll ID: 18203A0046

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

You might also like