Hi Guys Try this,

<html><head><title>Dynamic Title</title></head>
<%@ page language="java" import="java.sql.*" %>
<%@ page
import="java.io.*,java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,jav
a.util.*" %>
<%@ page session="true" buffer="8kb" autoFlush="true" isErrorPage="false"
isThreadSafe = "true" %>
<%
     response.setContentType("image/jpeg");
     int width=780, height=50,col=256;
     BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
     Graphics g = image.getGraphics();
     Random random = new Random();
     g.setColor(new Color(218,254,random.nextInt(height)+200));
     g.fillRect(0, 0, width, height);
     Polygon poly = new Polygon();
     for (int i=0; i < 20; i++) {
       poly.addPoint(random.nextInt(width),random.nextInt(height));
     }
     g.setColor(new
Color(random.nextInt(height),random.nextInt(col),random.nextInt(col)));
     g.fillPolygon(poly);
     g.setColor(new
Color(random.nextInt(col),random.nextInt(col),random.nextInt(height)+200));
     g.setFont(new Font("Serif",Font.ITALIC,48));
     g.drawString("Ravi Kumar",60,40);
     g.dispose();
     ServletOutputStream sos =response.getOutputStream();
     JPEGImageEncoder encoder =JPEGCodec.createJPEGEncoder(sos);
     encoder.encode(image);
%>
</body>
</html>

-VTR-

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to