image.java

来自「用javaBean+serlvet+jsp生成的MVC模式登陆与注册页面」· Java 代码 · 共 58 行

JAVA
58
字号
package servlet;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;

import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Image extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public Image() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}
	Color getRandColor(int fc, int bc) {//缁欏畾鑼冨洿鑾峰緱闅忔満棰滆壊
		  Random random = new Random();
		  if (fc > 255)
		   fc = 255;
		  if (bc > 255)
		   bc = 255;
		  int r = fc + random.nextInt(bc - fc);
		  int g = fc + random.nextInt(bc - fc);
		  int b = fc + random.nextInt(bc - fc);
		  return new Color(r, g, b);
		 
		}
	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		
			 //璁剧疆椤甸潰涓嶇紦瀛

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?