/*
TOPIC:TO IMPLEMENT CHARACTER GENERATION IN JAVA
WRITE A PROGRAM TO GENERATE INDIA
*/
import java.awt.*;
import java.util.*;
import java.applet.*;
public class Chargen extends Applet
{
public void paint(Graphics g)
{
int d[][] = {
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0,0 , 0, 1, 0,0 , 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
};
for(int P=0;P<13;P++)
{
for(int W=0;W<9;W++)
{
if(d[P][W]==1)
{
g.fillOval(200+(15*W),200+(15*P),5,5);
}
else
continue;
}
}
int e[][] = {
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 1, 0, 0, 0, 0, 1, 0},
{ 0, 1, 1, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 1, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 1, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 1, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 1, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 1, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
};
for(int q=0;q<13;q++)
{
for(int x=0;x<9;x++)
{
if(e[q][x]==1)
{
g.fillOval(300+(15*x),200+(15*q),5,5);
}
else
continue;
}
}
int b[][] = {
{ 1, 1, 1, 1, 1, 1, 1, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 1, 1, 1, 1, 1, 1, 1, 1, 0},
};
for(int k=0;k<13;k++)
{
for(int n=0;n<9;n++)
{
if(b[k][n]==1)
{
g.fillOval(450+(15*n),200+(15*k),5,5);
}
else
continue;
}
}
int c[][] = {
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0,0 , 0, 1, 0,0 , 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
};
for(int l=0;l<13;l++)
{
for(int o=0;o<9;o++)
{
if(c[l][o]==1)
{
g.fillOval(550+(15*o),200+(15*l),5,5);
}
else
continue;
}
}
int a[][] = {
{ 0, 0, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 1, 0, 1, 0, 0, 0},
{ 0, 0, 1, 0, 0, 0, 1, 0, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 1, 1, 1, 1, 1, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
{ 0, 1, 0, 0, 0, 0, 0, 1, 0},
};
for(int j=0;j<13;j++)
{
for(int m=0;m<9;m++)
{
if(a[j][m]==1)
{
g.fillOval(650+(15*m),200+(15*j),5,5);
}
else
continue;
}
}
}
}
/*
<applet code="Chargen.class" width="2000" height="2000">
</applet>
*/
No comments:
Post a Comment