JavaÉú³ÉͼƬÑéÖ¤Âë
JavaÉú³ÉͼƬÑéÖ¤Âë
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.*;
import java.awt.image.*;
import java.util.*;
import javax.imageio.*;
/**
*
* @author http://www.tot.name
* @version
*/
public class Image extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("image/jpeg");
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
HttpSession session=request.getSession();
// ÔÚÄÚ´æÖд´½¨Í¼Ïó
int width=60, height=20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// »ñȡͼÐÎÉÏÏÂÎÄ
Graphics g = image.getGraphics();
//Éú³ÉËæ»úÀà
Random random = new Random();
// É趨±³¾°É«
g.setColor(getRandColor(200,250));
g.fillRect(0, 0, width, height);
 
Ïà¹ØÎĵµ£º
1.Ïà¹ØÀàµÄ½éÉÜ
·þÎñÆ÷³ÌÐò²»Í¬ÓÚ¿Í»§»ú¶ËµÄ³ÌÐò£¬ËüÐèÒª³õʼ»¯Ò»¸ö¶Ë¿Ú½øÐмàÌý£¬Óöµ½Á¬½Óºô½Ð£¬²ÅÓëÏàÓ¦µÄ¿Í»§»ú½¨Á¢Á¬½Ó¡£Java.net°üµÄServerSocketÀà°üº¬Á˱àд·þÎñÆ÷ϵͳµÄÈ«²¿ËùÐ蹦ÄÜ£¬¶ø¿Í»§¶ËÈí¼þͨ³£Ê¹ÓÃjava.net°üÖеĺËÐÄÀàSocketÓë·þÎñÆ÷µÄij¸ö¶Ë¿Ú½¨Á¢Á¬½Ó¡£
2.µ¥Ï߳̿ͻ§¶Ë³ÌÐò½¨Á¢²½Ö裺
1£©½¨Á¢socket£ ......
±ØÐëÓÃthis¹Ø¼ü×ÖµÄÈýÖÖÇé¿ö:
1.ÎÒÃÇÏëͨ¹ý¹¹Ôì·½·¨½«Íⲿ´«ÈëµÄ²ÎÊý¸³Öµ¸ø³ÉÔ±±äÁ¿,¶ø¹¹Ôì·½·¨µÄÐÎʽ²ÎÊýÓëÀà³ÉÔ±µÄ±äÁ¿ÃûÏàͬ,Õâʱ¾ÍÐèÒªthisÕâ¸ö¹Ø¼ü×ÖÀ´Çø±ð¾Ö²¿±äÁ¿ÓëÀà±äÁ¿;
2.¼ÙÉèÓÐÒ»¸öÈÝÆ÷ÀàºÍÒ»¸ö²¿¼þÀà,ÔÚÈÝÆ÷ÀàµÄij¸ö·½·¨ÖÐÒª´´½¨²¿¼þÀàµÄʵÀý¶ÔÏó,¶ø²¿¼þÀàµÄ¹¹Ôì·½·¨Òª½ÓÊÕÒ»¸ö´ú±íÆäËùÔÚÈÝÆ÷µÄ²ÎÊý,ÕâÊ±Ò²Ò ......
Ìõ¼þ£ºÒÑ°²×°J2SEºÍJ2EE¡£
Microsoft SQL Server 2000 Driver for JDBCÊÇ΢Èí¹«Ë¾Ãâ·ÑÌṩÃâ·ÑÏÂÔصÄÒ»¸öÈí¼þ£¬Çë·ÃÎÊ£º http://www.microsoft.com/sql/default.asp£¬ÏÂÔغóÎļþÃûΪ£ºsetup.exe£¬°²×°ºó£¬Ä¬ÈÏ·¾¶ÊÇ£º%Program Files%\Microsoft SQL Server 2000 Driver for JDBC£¬¸ÃĿ¼ÏÂLIBĿ¼ÀïÓÐ3¸öjarÎļþ¡£ ......
µ¥Ì¬¶¨Òå:
SingletonģʽÖ÷Òª×÷ÓÃÊDZ£Ö¤ÔÚJavaÓ¦ÓóÌÐòÖУ¬Ò»¸öÀàClassÖ»ÓÐÒ»¸öʵÀý´æÔÚ¡£
Singletonģʽ¾ÍΪÎÒÃÇÌṩÁËÕâÑùʵÏֵĿÉÄÜ¡£Ê¹ÓÃSingletonµÄºÃ´¦»¹ÔÚÓÚ¿ÉÒÔ½ÚÊ¡Äڴ棬ÒòΪËüÏÞÖÆÁËʵÀýµÄ¸öÊý£¬ÓÐÀûÓÚJavaÀ¬»ø»ØÊÕ£¨garbage col ......
¼¯ºÏCollection½Ó¿Ú
--Collection ÊÇÈκζÔÏó×飬ԪËظ÷×Ô¶ÀÁ¢£¬Í¨³£ÓµÓÐÏàͬµÄÌ×ÓùæÔò¡£Set ListÓÉËüÅÉÉú¡£
»ù±¾²Ù×÷ Ôö¼ÓÔªËØadd(Object obj); addAll(Collection c);
ɾ³ýÔªËØ remove(Object obj); removeAll(Collection c);
Çó½»¼¯ retainAll(Collection c);
ɾ³ýÔªËØ remove(Object obj); removeAll(Collectio ......