当前位置: 代码迷 >> Web前端 >> 设置密文在图片下1
  详细解决方案

设置密文在图片下1

热度:82   发布时间:2012-08-24 10:00:21.0
设置密文在图片上1
package com.Dao;

import java.io.*;

import com.sun.image.codec.jpeg.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.*;

public class Test
{
   
    /**
     * 设置密文在图片上
     *
     * @param g
     * @param onOff
     * @param buffHeight
     * @param strEnc
     * @see [类、类#方法、类#成员]
     */
    public static void addCipherText(Graphics g, String onOff, int buffHeight, String strEnc)
    {
        String mobile = "15011112222";
        try
        {
            strEnc = EncryptUtil.encrypt(mobile, "7cp0kqc84yv9nzs2");
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
       
        if (onOff.equals("1"))
        {
            g.drawString(strEnc, 15, 35);
            g.drawString(strEnc, 200, buffHeight - 35);
            for (int j = 0; j < 5; j++)
            {
                g.drawString(strEnc, 200, j * 200);
            }
        }
        else
        {
            g.drawString(strEnc, 15, 35);
            g.drawString(strEnc, 200, buffHeight - 35);
            for (int i = 0; i < getBuf(buffHeight); i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    g.drawString(strEnc, 200, j * 200 * i);
                }
            }
        }
    }
   
    /**
     * <一句话功能简述> <功能详细描述>
     *
     * @param buffHeight
     * @return
     * @see [类、类#方法、类#成员]
     */
    public static int getBuf(int buffHeight)
    {
        int buf = 0;
        if (buffHeight % 1000 == 0)
        {
            buf = buffHeight / 1000;
        }
        else
        {
            buf = buffHeight / 1000 + 1;
        }
        return buf;
    }
  相关解决方案