package rge;
import java
import java
import java
import java
import java
import javax
import javax
import dec
/**
* @author Liao Xue Feng
*/
public class CreateImageServlet extends HttpServlet {
protected void doGet(HttpServletRequest request
throws ServletException
{
response
createImage(response
}
private void createImage(OutputStream out) {
String text =
int width =
int height = text
BufferedImage bi = new BufferedImage(width
Graphics
// set background:
g
g
Font mFont = new Font(
g
g
int x=
int y=
int count = text
int i =
String getone = null;
while(count >
{
getone = text
if(i %
{
y = y +
x =
}
//g
g
x = x +
i++ ;
count
}
// end draw:
g
bi
// encode:
JPEGImageEncoder encoder = JPEGCodec
JPEGEncodeParam param = encoder
param
encoder
try {
encoder
}
catch(IOException ioe) {
ioe
}
}
}
inde
<%@ page language=
<!DOCTYPE HTML PUBLIC
<html>
<head>
<title>系統測試(From:網絡大本營Http://)</title>
<meta http
<meta http
<meta http
<meta http
<meta http
<!
<link rel=
<meta http
<!
body {
background
}
</style></head>
<body>
<img src=
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26817.html