java ÖеÄÑéÖ¤Âë
<%@ page language="java" import="java.util.*" pageEncoding="GBK"
import="java.awt.*,java.awt.image.*,javax.imageio.*"%><%
/*
ʹÓ÷½·¨£ºÔÚÐèÒªÏÔʾÑéÖ¤ÂëµÄhtml´úÂëÖÐʹÓÃ<img p">
ÔÚÐèÅжÏsessionµÄʱºòÅжÏsession.getAttribute("vcode")
*/try{
int codeLength=4;//ÑéÖ¤Â볤¶È
int mixTimes=0;//Ä£ºý³Ì¶È²ÎÊý
Color bgColor=getRandColor(200, 250);//±³¾°ÑÕÉ«
Color bfColor=new Color(0,0,0);//×ÖÌåÑÕÉ«
boolean ifRandomColor=true;//µ¥¸ö×Ö·ûÊÇ·ñÑÕÉ«Ëæ»ú
boolean ifMixColor=true;//Ä£ºýÏßÊÇ·ñÑÕÉ«Ëæ»ú
//ÉèÖÃÒ³Ãæ²»»º´æ
// ÔÚÄÚ´æÖд´½¨Í¼Ïó
int width = 13*codeLength+6, height = 20;
BufferedImage image = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);
// »ñȡͼÐÎÉÏÏÂÎÄ
Graphics g = image.getGraphics();
// É趨±³¾°É«
g.setColor(bgColor);
g.fillRect(0, 0, width, height);
//É趨×ÖÌå
g.setFont(new Font("Times New Roman", Font.PLAIN, 18));
//»±ß¿ò
g.setColor(new Color(33,66,99));
g.drawRect(0,0,width-1,height-1);
// Ëæ»ú²úÉú¸ÉÈÅÏߣ¬Ê¹Í¼ÏóÖеÄÈÏÖ¤Âë²»Ò×±»ÆäËü³ÌÐò̽²âµ½
g.setColor(getRandColor(160, 200));
for (int i = 0; i < mixTimes*codeLength/10; i++) {
if(ifMixColor)
{
g.setColor(getRandColor(160, 200));
}
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
}
// È¡Ëæ»ú²úÉúµÄÈÏÖ¤Âë(4λÊý×Ö)
String sRand = "";
for (int i = 0; i < codeLength; i++) {
String rand = String.valueOf(random.nextInt(10));
sRand += rand;
// ½«ÈÏÖ¤ÂëÏÔʾµ½Í¼ÏóÖÐ
if(ifRandomColor)
g.setColor(getRandColor(20,110,0));
else
g.setColor(bfColor);
//µ÷Óú¯Êý
Ïà¹ØÎĵµ£º
µÚ¾ÅÕÂ
»ùÓÚÎı¾µÄjavaÓ¦ÓóÌÐò
inputsreamreader is=new inputstreamreader(system.in)
bufferedreader br=new bufferedreader(is)
s=br.readline();
while(!s.euqal("")){}
FLIE f=new file()
filereader ÒÔ×Ö·ûΪµ¥Î»
bufferedreaderÀàµÄreadline
ÒÔÐÐΪµ¥Î»¶ÁÈëÒ»ÐÐ×Ö·û
filewriterÒÔ×Ö·ûΪµ¥Î»ÏòÎļþд³öÊý¾ ......
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Calculator
{
public static void main(String[] args)
......
1.Prototyping: in general (Enterprise) Java projects start with evaluation which frameworks to use. This can take from few hours, to several months (although these times are hopefully over). Java EE 6 comes with “one stop shopping”. You can download Java EE 6 with the IDE (eclipse, netbe ......
JavaÓëXMLÁªºÏ±à³ÌÖ®DOMƪ
DOM³õ²½
DOM
ÊÇDocument Object
ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°ÃæËµ¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬Îª
XMLÎĵµÔÚÂß¼ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£ ......
JDKΪ³ÌÐòÔ±ÌṩÁË´óÁ¿µÄÀà¿â£¬¶øÎªÁ˱£³ÖÀà¿âµÄ¿ÉÖØÓÃÐÔ£¬¿ÉÀ©Õ¹ÐÔºÍÁé»îÐÔ£¬ÆäÖÐʹÓõ½ÁË´óÁ¿µÄÉè¼ÆÄ£Ê½£¬±¾ÎĽ«½éÉÜJDKµÄI/O°üÖÐʹÓõ½µÄDecoratorģʽ£¬²¢ÔËÓôËģʽ£¬ÊµÏÖÒ»¸öеÄÊä³öÁ÷Àà¡£
¡¡¡¡Decoratorģʽ¼ò½é
¡¡¡¡DecoratorģʽÓÖÃû°ü×°Æ÷(Wrapper)£¬ËüµÄÖ÷ÒªÓÃ;ÔÚÓÚ¸øÒ»¸ö¶ÔÏó¶¯Ì¬µÄÌí¼ÓһЩ¶îÍâµÄÖ°Ôð¡£Ó ......