index.jsp
<%@ page language="java" %>
<html>
<head><title>Welcome JSP-Applet Page</title></head>
<body>
<jsp:plugin type="applet" code="Myapplet.class" width="600" height="600">
<jsp:fallback><p>Unable to load applet</p></jsp:fallback>
</jsp:plugin>
</body>
</html>
p7.java
import java.awt.*;
import java.applet.*;
public class Myapplet extends Applet
{
public void init()
{
setBackground(Color.blue);
}
public void paint(Graphics g)
{
int y=50,x=50;
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
{
if((i+j)%2!=0)
{
g.setColor(Color.black);
}
else
{
g.setColor(Color.white);
}
g.fillRect(x,y,50,50);
x=x+50;
}
y=y+50;
x=50;
}
}
}
<%@ page language="java" %>
<html>
<head><title>Welcome JSP-Applet Page</title></head>
<body>
<jsp:plugin type="applet" code="Myapplet.class" width="600" height="600">
<jsp:fallback><p>Unable to load applet</p></jsp:fallback>
</jsp:plugin>
</body>
</html>
p7.java
import java.awt.*;
import java.applet.*;
public class Myapplet extends Applet
{
public void init()
{
setBackground(Color.blue);
}
public void paint(Graphics g)
{
int y=50,x=50;
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
{
if((i+j)%2!=0)
{
g.setColor(Color.black);
}
else
{
g.setColor(Color.white);
}
g.fillRect(x,y,50,50);
x=x+50;
}
y=y+50;
x=50;
}
}
}
No comments:
Post a Comment