Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views1 page

Java 5B

The document contains a Java applet program that creates a grid of rectangles. It uses nested loops to draw a 5x5 grid with each rectangle measuring 30x30 pixels. The applet is designed to be displayed with a width and height of 200 pixels.

Uploaded by

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

Java 5B

The document contains a Java applet program that creates a grid of rectangles. It uses nested loops to draw a 5x5 grid with each rectangle measuring 30x30 pixels. The applet is designed to be displayed with a width and height of 200 pixels.

Uploaded by

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

5B. Program to create an applet and draw grid line.

/*<applet code="GridLine.class" width=200 height=200></applet>*/


import java.awt.*;
import java.applet.*;
public class GridLine extends Applet
{
public void paint(Graphics g)
{
int r,c,x,y;
for(r=0;r<5;r++)
{
for(c=0;c<5;c++)
{
x=r*30;
y=c*30;
g.drawRect(x,y,30,30);
}
}
}
}
OUTPUT:

You might also like