Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaͼƬ´¦Àí ÎÄ×Öˮӡ ͼƬˮӡ Ëõ·Å ²¹°×

 import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* @author Eric Xu
*
*/
public final class ImageUtils {
/**
* ͼƬˮӡ
* @param pressImg ˮӡͼƬ
* @param targetImg Ä¿±êͼƬ
* @param x ÐÞÕýÖµ ĬÈÏÔÚÖмä
* @param y ÐÞÕýÖµ ĬÈÏÔÚÖмä
* @param alpha ͸Ã÷¶È
*/
public final static void pressImage(String pressImg, String targetImg, int x, int y, float alpha) {
try {
File img = new File(targetImg);
Image src = ImageIO.read(img);
int wideth = src.getWidth(null);
int height = src.getHeight(null);
BufferedImage image = new BufferedImage(wideth, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.drawImage(src, 0, 0, wideth, height, null);
//ˮӡÎļþ
Image src_biao = ImageIO.read(new File(pressImg));
int wideth_biao = src_biao.getWidth(null);
int height_biao = src_biao.getHeight(null);
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g.drawImage(src_biao, (wideth - wideth_biao) / 2, (height - height_biao) / 2, wideth_biao, height_biao, null);
//ˮӡÎļþ½áÊø
g.dispose();
ImageIO.write((BufferedImage) image, "jpg", img);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ÎÄ×Öˮӡ
* @param pressText ˮӡÎÄ×Ö
* @param targetImg Ä¿±êͼƬ
* @param fontName ×ÖÌåÃû³Æ
* @param fontStyle ×ÖÌåÑùʽ
* @param color ×ÖÌåÑÕÉ«
* @param fontSize ×ÖÌå´óС
* @param x ÐÞÕýÖµ
* @param y ÐÞÕýÖµ
* @param alpha ͸Ã÷¶È
*/
public static void pressText(String pressText, String targetImg, String fontName, int fontStyle, Color color, int fontSize, int x, int y, float alpha) {
try {
File img = new File(targetI


Ïà¹ØÎĵµ£º

Õë¶Ôjava»­ÃæÉÁ˸


     ÈçÌ⣡½â¾öµÄ·½·¨ÊÇÔö¼ÓÒ»¸öÐé±³¾°¡£Ö®ºó°ÑÐé±³¾°Ôö¼Óµ½Ô­À´µÄFrameÉÏ¡£ÓÉÓÚrepaint()µ½paint()ÖмäÉæ¼°µ½update(),ËùÒÔ½â¾öÎÊÌâµÄ
¹Ø¼üÊÇÔÚÖØдupdate(),ÔÚÕâ¸ö·½·¨ÖÐʵÏÖÐé±³¾°µÄÌí¼Ó~~
   @Override
public void update(Graphics g) 
{
if(offScreenImage == null) ......

java exception javaÒì³£»ã×Ü(3)

java exception ½â¾ö·½°¸ - ÎÒµÄÒì³£Íø|Òì³£|exception   791 - java.lang.NoSuchMethodError 792 - RuntimeException 793 - org.hibernate.exception.SQLGrammarException 794 - Internal Error 795 - ×Ô¶¨ÒåÒì³£ 796 - org.dom4j.DocumentException 797 - java.net.SocketException 798 - Exception¶ÔÏó 799 - SQLE ......

Java Application Ö±½Óͨ¹ýjndiÁ¬½ÓÊý¾Ý¿â

 Ê¹ÓÃjar°ü:
 commons-pool-1.5.3.jar,tomcat-naming-common.jar,commons-pool-1.5.3-bin.zip,commons-dbcp.jar
 ×¢Òâ:jdbc Çý¶¯ÒªÓëÊý¾Ý¿â¼æÈÝ.
 package test.comm;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Hashtable;
import javax.naming.InitialCont ......

Java¶ÁдtxtÎļþ

 ±ÊÊÔµÄʱºòÏë²»ÆðÀ´ÔõôдÁË¡£Áô¸ö´úÂë×÷¼ÍÄî
package common;
import java.io.*;
import java.util.ArrayList;
public class IOTest {
public static void main (String args[]) {

ReadDate();

WriteDate();

}

/**
* ¶ÁÈ¡Êý¾Ý
*/
public static void ReadDate() {
......

java filterÓ÷¨´óÈ«

¹Ø¼ü×Ö: filter
    ¹ýÂËÆ÷FilterÒ²¾ßÓÐÉúÃüÖÜÆÚ£ºinit()->doFilter()->destroy()£¬Óɲ¿ÊðÎļþÖеÄfilterÔªËØÇý¶¯¡£ÔÚservlet2.4ÖУ¬¹ýÂËÆ÷ͬÑù¿ÉÒÔÓÃÓÚÇëÇó·ÖÅÉÆ÷£¬µ«ÐëÔÚweb.xmlÖÐÉùÃ÷£¬<dispatcher>INCLUDE»òFORWARD»òREQUEST»òERROR</dispatcher>¸ÃÔªËØλÓÚfilter-mappingÖС£
Ò»¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ