亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? captcha.java

?? ZK 基礎(chǔ)介紹 功能操作 模塊 結(jié)合數(shù)據(jù)庫操作
?? JAVA
字號(hào):
/* Captcha.java{{IS_NOTE	Purpose:			Description:			History:		Thu Mar 15 10:03:48     2007, Created by henrichen}}IS_NOTECopyright (C) 2007 Potix Corporation. All Rights Reserved.{{IS_RIGHT	This program is distributed under GPL Version 2.0 in the hope that	it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.zul;import org.zkoss.zk.ui.Component;import org.zkoss.zk.ui.Executions;import org.zkoss.zk.ui.UiException;import org.zkoss.zk.ui.event.Event;import org.zkoss.zk.ui.event.Events;import org.zkoss.zk.ui.event.EventListener;import org.zkoss.zul.impl.CaptchaEngine;import org.zkoss.image.AImage;import org.zkoss.lang.Classes;import org.zkoss.lang.Objects;import org.zkoss.lang.Strings;import java.awt.Font;import java.awt.Image;import java.awt.Color;import java.util.Date;import java.util.List;import java.util.Random;import java.util.ArrayList;/** * The generic captcha component.  * @author henrichen */public class Captcha extends org.zkoss.zul.Image {	//control variable	private boolean _smartDrawCaptcha; //whether post the smartDraw event already?	private transient EventListener _smartDrawCaptchaListener; //the smartDrawListner		private static Random _random = new Random();//random used for various operation	private static final String EXCLUDE = "0123456789IOilo"; //default exclude list	private static final int CHAR_START = '0'; //character start	private static final int CHAR_END = 'z'; //character end	private static final int CHAR_COUNT = CHAR_END - CHAR_START + 1; //charcater count	private static final Font[] DEFAULT_FONTS = new Font[] {		new Font("Arial", Font.BOLD, 35),		new Font("Courier", Font.BOLD, 35)				};		private int _intWidth = 200; //integer width in px	private int _intHeight = 50; //integer height in px		private String _fontColor = "#404040"; //font color that used to draw text	private int _fontRGB = 0x404040; //font color in 0xRRGGBB		private String _bgColor = "#74979B"; //background color in #RRGGBB form	private int _bgRGB = 0x74979B; //background color in 0xRRGGBB		private List _fonts = new ArrayList(9); //fonts that can be used to draw text	private int _len = 5; //text length, default 5	private String _exclude = null;	private String _value; //captcha text value 	private boolean _noise = true; //whether generate noise	private CaptchaEngine _engine; //the captcha engine that generate the distortion image.	public Captcha() {		setWidth("200px");		setHeight("50px");		randomValue();		smartDrawCaptcha();	}		/**	 * Gets fonts list, default provide two fonts.	 */	public List getFonts() {		return _fonts;	}		/**	 * Gets the default font list.	 */	public Font[] getDefaultFonts() {		return DEFAULT_FONTS;	}		/**	 * Get nth Font.	 */	public Font getFont(int j) {		if (_fonts.isEmpty()) {			return DEFAULT_FONTS[j];		}		return (Font) _fonts.get(j);	}		/**	 * Add fonts into fonts list. If you did not add fonts, the default implementation	 * would use the default fonts; i.e. bold Arial 35, and bold courier 35.	 */	public void addFont(Font font) {		_fonts.add(font);	}	/**	 * Set font color.	 */	public void setFontColor(String color) {		if (Objects.equals(color, _fontColor)) {			return;		}		_fontColor = color;		if (_fontColor == null) {			_fontRGB = 0;		} else {			_fontRGB = decode(_fontColor);		}		smartDrawCaptcha();	}		/**	 * Gets font color.	 */	public String getFontColor() {		return _fontColor;	}		/**	 * Get the font color in int array (0: red, 1: green, 2:blue).	 */	public int getFontRGB() {		return _fontRGB;	}	/**	 * Set the background color of the chart.	 * @param color in #RRGGBB format (hexdecimal).	 */	public void setBgColor(String color) {		if (Objects.equals(color, _bgColor)) {			return;		}		_bgColor = color;		if (_bgColor == null) {			_bgRGB = 0;		} else {			_bgRGB = decode(_bgColor);		}		smartDrawCaptcha();	}		/**	 * Get the background color of the captcha box (in string as #RRGGBB).	 * null means default.	 */	public String getBgColor() {		return _bgColor;	}		/**	 * Get the background color in int array (0: red, 1: green, 2:blue).	 * null means default.	 */	public int getBgRGB() {		return _bgRGB;	}	/**	 * Override super class to prepare the int width.	 */	public void setWidth(String w) {		if (Objects.equals(w, getWidth())) {			return;		}		_intWidth = Chart.stringToInt(w);		super.setWidth(w);		smartDrawCaptcha();	}		/**	 * Get the captcha int width in pixel; to be used by the derived subclass.	 */	public int getIntWidth() {		return _intWidth;	}		/**	 * Override super class to prepare the int height.	 */	public void setHeight(String h) {		if (Objects.equals(h, getHeight())) {			return;		}		_intHeight = Chart.stringToInt(h);		super.setHeight(h);		smartDrawCaptcha();	}		/**	 * Get the captcha int height in pixel; to be used by the derived subclass.	 */	public int getIntHeight() {		return _intHeight;	}		/**	 * Get the text value of this captcha.	 */	public String getValue() {		return _value;	}		/**	 * Set the text value to be shown as the distortion captcha.	 * @param text the captcha text value	 */	public void setValue(String text) {		if (Objects.equals(text, _value)) {			return;		}		_value = text;				smartDrawCaptcha();	}		/** Set length of the autogenerated text value; default to 5.	 */	public void setLength(int len) {		if (len == _len) {			return;		}		_len = len;		randomValue();		smartDrawCaptcha();	}		/** Get length of the autogenerated text value; default to 5.	 */	public int getLength() {		return _len;	}		/** Set exclude characters that will not be generated. Note that only digit and character is used	 * in generating text value. If you leave exclude null, the default exclude list will be applied; 	 * i.e.,  0123456789IilOo (only character (no digits) are used except I, i, l, O(big O), o(small o))	 */	public void setExclude(String exclude) {		if (Objects.equals(_exclude, exclude))			return;					_exclude = exclude;		randomValue();		smartDrawCaptcha();	}		/** Get exclude characters.	 */	public String getExclude() {		return _exclude;	}		/** Wheather generate noise; default to true.	 */	public void setNoise(boolean b) {		_noise = b;	}		/** Whether generate noise; default to true.	 */	public boolean isNoise() {		return _noise;	}		/**	 * Regenerates new captcha text value and redraw.	 */	public String randomValue() {		String exclude = _exclude == null ? EXCLUDE : _exclude;		int len = _len;						final StringBuffer sb = new StringBuffer(len);		while (len > 0) {			final char c = (char) ('0' + _random.nextInt(CHAR_COUNT)); // ASCII '0' to 'z'			if (Character.isLetterOrDigit(c) && exclude.indexOf((int)c) < 0) {				sb.append(c); 				--len;			}		}		setValue(sb.toString());		return getValue();	}		/** Sets the captcha engine by use of a class name.	 * It creates an instance automatically.	 */	public void setEngine(String clsnm)	throws ClassNotFoundException, NoSuchMethodException,	InstantiationException, java.lang.reflect.InvocationTargetException {		if (clsnm != null) {			setEngine((CaptchaEngine)Classes.newInstanceByThread(clsnm));		}	}	/**	 * Set the captcha engine.	 */	public void setEngine(CaptchaEngine engine) {		if (_engine != engine) {			_engine = engine;		}				smartDrawCaptcha();	}		/**	 * Get the captcha engine.	 *	 * @exception UiException if failed to load the engine.	 */	public CaptchaEngine getCaptchaEngine()	throws UiException {		if (_engine == null)			_engine = newCaptchaEngine();		return _engine;	}	/** Instantiates the default captcha engine.	 * It is called, if {@link #setEngine} is not called with non-null	 * engine.	 *	 * <p>By default, it looks up the component attribute called	 * captcha-engine. If found, the value is assumed to be the class	 * or the class name of the default engine (it must implement	 * {@link CaptchaEngine}.	 * If not found, {@link UiException} is thrown.	 *	 * <p>Derived class might override this method to provide your	 * own default class.	 *	 * @exception UiException if failed to instantiate the engine	 * @since 3.0.0	 */	protected CaptchaEngine newCaptchaEngine() throws UiException {		Object v = getAttribute("captcha-engine");		if (v == null)			v = "org.zkoss.zkex.zul.impl.JHLabsCaptchaEngine";		try {			final Class cls;			if (v instanceof String) {				cls = Classes.forNameByThread((String)v);			} else if (v instanceof Class) {				cls = (Class)v;			} else {				throw new UiException(v != null ? "Unknown captcha-engine, "+v:					"The captcha-engine attribute is not defined");			}				v = cls.newInstance();		} catch (Exception ex) {			throw UiException.Aide.wrap(ex);		}		if (!(v instanceof CaptchaEngine))			throw new UiException(CaptchaEngine.class + " must be implemented by "+v);		return (CaptchaEngine)v;	}	/**	 * mark a draw flag to inform that this Chart needs update.	 */	protected void smartDrawCaptcha() {		if (_smartDrawCaptcha) { //already mark smart draw			return;		}		_smartDrawCaptcha = true;		if (_smartDrawCaptchaListener == null) {			_smartDrawCaptchaListener = new EventListener() {				public void onEvent(Event event) {					if (Strings.isBlank(getValue()))						throw new UiException("captcha must specify text value");											if (Strings.isBlank(getWidth()))						throw new UiException("captcha must specify width");														if (Strings.isBlank(getHeight()))						throw new UiException("captcha must specify height");													try {						//generate the distorted image based on the given text value						byte[] bytes = getCaptchaEngine().generateCaptcha(Captcha.this);						final AImage image = new AImage("captcha"+new Date().getTime(), bytes);						setContent(image);					} catch(java.io.IOException ex) {						throw UiException.Aide.wrap(ex);					} finally {						_smartDrawCaptcha = false;					}				}			};			addEventListener("onSmartDrawCaptcha", _smartDrawCaptchaListener);		}		Events.postEvent("onSmartDrawCaptcha", this, null);	}		/*package*/ static int decode(String color) {		if (color == null) {			return 0;		}		if (color.length() != 7 || !color.startsWith("#")) {			throw new UiException("Incorrect color format (#RRGGBB) : "+color);		}		return Integer.parseInt(color.substring(1), 16);	}}		

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级黄色录像| 国产区在线观看成人精品| 国产麻豆视频一区| 一区二区三区中文字幕| 久久综合九色综合97婷婷女人| 色偷偷88欧美精品久久久| 国产一区视频在线看| 亚洲伊人伊色伊影伊综合网| 久久久国际精品| 欧美一级午夜免费电影| 色老头久久综合| 国产电影精品久久禁18| 麻豆久久久久久| 亚洲成av人片一区二区| **欧美大码日韩| 久久精品亚洲精品国产欧美kt∨| 欧美日韩国产精品自在自线| 91在线免费播放| 成人一级片网址| 国产剧情一区二区| 久久精品久久99精品久久| 亚洲成人免费观看| 亚洲午夜在线电影| 亚洲免费成人av| 综合av第一页| 亚洲特级片在线| 亚洲色图.com| 伊人性伊人情综合网| 国产精品萝li| 中文字幕一区免费在线观看| 国产精品久久久久一区| 中文字幕国产一区| 日本一区二区成人在线| 日本一区二区免费在线观看视频| 久久久亚洲午夜电影| 久久久国产精品不卡| 久久久噜噜噜久久中文字幕色伊伊| 精品国一区二区三区| 欧美一级电影网站| 日韩精品一区在线| 日韩美女一区二区三区四区| 日韩欧美高清一区| 精品久久五月天| 久久久99免费| 中文字幕av一区 二区| 中文字幕av在线一区二区三区| 国产嫩草影院久久久久| 国产精品视频线看| 亚洲欧洲www| 亚洲国产精品一区二区久久恐怖片 | 亚洲成人在线观看视频| 亚洲v日本v欧美v久久精品| 婷婷久久综合九色综合绿巨人 | 国产乱妇无码大片在线观看| 国产成人亚洲精品青草天美| 国产91精品一区二区| 99精品黄色片免费大全| 日本道精品一区二区三区| 精品婷婷伊人一区三区三| 这里是久久伊人| 久久亚洲精品国产精品紫薇| 日本一区二区在线不卡| 中文字幕一区二区在线观看| 一区二区三区**美女毛片| 三级欧美在线一区| 午夜亚洲福利老司机| 欧美性猛片aaaaaaa做受| 制服丝袜亚洲精品中文字幕| 日韩欧美一二区| 久久久久久久久一| 中文字幕一区二区日韩精品绯色| 亚洲激情五月婷婷| 免费精品视频最新在线| 国产精品一区二区久激情瑜伽| a美女胸又www黄视频久久| 色婷婷国产精品| 日韩视频一区二区在线观看| 韩日精品视频一区| 欧美激情一区二区| 91精品国产手机| 色偷偷久久一区二区三区| 国内偷窥港台综合视频在线播放| 一区二区三区国产| 欧美国产精品久久| 日韩一区国产二区欧美三区| 成人综合在线网站| 午夜免费久久看| 中文字幕一区二区三区av| 久久亚洲综合av| 欧美精三区欧美精三区| 99久久er热在这里只有精品15 | 日本一区二区三区dvd视频在线 | 成人精品一区二区三区四区 | 成人性生交大合| 亚洲人成电影网站色mp4| 久久国产精品色婷婷| 欧美日产在线观看| 亚洲777理论| 日韩一级片网站| 国内成人精品2018免费看| 精品乱码亚洲一区二区不卡| 日本vs亚洲vs韩国一区三区二区 | 麻豆精品视频在线观看免费| 欧美电影免费观看高清完整版 | 欧美中文字幕亚洲一区二区va在线| 亚洲欧美在线高清| 欧美美女直播网站| 国产一区二区三区日韩| 国产精品天干天干在观线| 色哟哟国产精品免费观看| 日韩国产欧美一区二区三区| 久久精品人人做人人综合| 91丝袜高跟美女视频| 日韩制服丝袜av| 国产日韩欧美一区二区三区乱码| 色综合 综合色| 久久99久久精品| 国产精品麻豆99久久久久久| 欧美日韩一区在线| 成人小视频免费观看| 亚洲成av人片一区二区| 国产人妖乱国产精品人妖| 717成人午夜免费福利电影| 国产精一品亚洲二区在线视频| 亚洲色图欧洲色图| www日韩大片| 欧美色爱综合网| www.日韩大片| 激情偷乱视频一区二区三区| 亚洲桃色在线一区| 国产色产综合色产在线视频 | 日日噜噜夜夜狠狠视频欧美人 | 精品sm在线观看| 欧美色图激情小说| 波多野洁衣一区| 精品一区二区三区影院在线午夜 | 亚洲人成小说网站色在线| 日韩一区二区三区电影在线观看| 成人午夜视频在线观看| 捆绑紧缚一区二区三区视频| 亚洲成av人片在www色猫咪| 国产精品久久久久一区二区三区| 欧美精品一区在线观看| 7777精品伊人久久久大香线蕉 | 色久综合一二码| 国产99精品视频| 国产在线观看免费一区| 韩国av一区二区三区| 亚洲电影中文字幕在线观看| 亚洲欧美偷拍另类a∨色屁股| 国产亚洲一区二区在线观看| 欧美一区二区大片| 欧美精品第1页| 欧美亚洲动漫精品| 欧美亚洲高清一区| 欧美中文字幕一二三区视频| 97成人超碰视| 91麻豆免费在线观看| 福利一区二区在线| 成人做爰69片免费看网站| 国产成人av电影在线观看| 国产91丝袜在线观看| 国产乱色国产精品免费视频| 精品系列免费在线观看| 久久国产剧场电影| 精品一区二区国语对白| 精品一区二区三区不卡| 老司机精品视频导航| 国产一区二区网址| 国产91清纯白嫩初高中在线观看| 国产大陆a不卡| 成人性视频免费网站| 99亚偷拍自图区亚洲| 色系网站成人免费| 欧美精选一区二区| 91精品国产综合久久精品性色| 日韩一级高清毛片| 精品国产91洋老外米糕| 国产欧美一区在线| **网站欧美大片在线观看| 亚洲最大的成人av| 水野朝阳av一区二区三区| 日本不卡一二三区黄网| 免费看日韩a级影片| 国产精品中文欧美| 91网站最新地址| 精品视频色一区| 欧美mv和日韩mv的网站| 亚洲国产高清在线| 一区二区三区中文字幕精品精品 | 日本高清成人免费播放| 欧美日韩一本到| 日韩欧美成人一区| 国产精品电影一区二区三区| 一区二区三区精密机械公司| 三级欧美韩日大片在线看| 国产成人在线色| 欧美日韩中文字幕一区| 久久这里都是精品| 国产伦精品一区二区三区视频青涩 |