Captcha

A captcha component can generate a special distortion image, also called a CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) image. Developers could set height and width for dimension of captcha. By default, captcha render the image with a randomly generated text, and developers can set value to assign a purposive text.

<vbox>
<captcha id="cpa" length="5" width="200px" height="50px"/>
</vbox>

Class Name

org.zkoss.zul.Captcha

Supported Child Components

*NONE

Supported Events

Name

Event Type

onClick

org.zkoss.zk.ui.event.MouseEvent

Description: Denotes user has clicked the component.

Use getX(), getY() method get coo rdinates.

Properties

Property

Description

Data Type

Default Value

bgColor

Sets the background color of the chart. It must be #RRGGBB format (hexdecimal).

String

"#74979B"

exclude

Sets 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))

String

" 0123456789IOilo "

fontColor

Sets font color. It must in #RRGGBB format (hexdecimal).

String

#404040

height

Sets height of captcha, it colud be a px, pt or em value and it will transfer to px.

String

50

length

Sets length of the autogenerated text value

int

5

noise

Sets the flag of noise generation

boolean

true

value

Sets the text value to be shown as the distortion captcha

String

Random Value

width

Set width of captcha, it colud be a px, pt or em value and it will transfer to px.

String

200

Methods

Name

Description

Return Data Type

addFont

Adds fonts into fonts list.

void

getBgRGB

Gets the background color in int

int

getCaptchaEngine

Gets the captcha engine.

CaptchaEngine

getDefaultFonts

Gets the default font list.

java.awt.Font[]

getFont

Gets n-th Font

java.awt.Font

getFontRGB

Gets the font color in int.

int

getFonts

Gets fonts list, default provide two fonts.

java.util.List

getIntHeight

Gets the captcha int height in pixel; to be used by the derived subclass.

int

getIntWidth

Get the captcha int width in pixel; to be used by the derived subclass.

int

newCaptchaEngine

Instantiates the default captcha engine.

CaptchaEngine

randomValue

Regenerates new captcha text value and redraw

String

setEngine

Set the captcha engine instance or by a class name string.

void

smartDrawCaptcha

Marks a draw flag to inform that this Chart needs update.

void

Inherited From