进入旧版 | 服务项目 | 成功案例 | 联系方式 | 过客留言 | 友情链接
   
设为首页
加入收藏
联系我们
网站首页 | 新闻资讯 | 操作系统 | 办公软件 | 网络软件 | 工具软件 | 媒体动画 | 网页制作 | 网站开发 | 程序开发 | 平面设计
Photoshop视频教程 | Word入门 | Flash入门 | JScript | VBScript | ASP | PHP | ADO | 网页特效 | 3DS MAX6.0命令 | 系统进程
您当前的位置:GOODSGY电脑学习网 -> 网站开发 -> JSP -> 文章内容  
在服务器端动态生成gif or jpg示例

package web.images;

/**
* 此处插入类型描述。
* 创建日期:(2002-6-6 9:59:00)
* @author:Administrator
*/
import java.io.*;

import java.util.*;

import com.sun.image.codec.jpeg.*;

import java.awt.image.*;

import java.awt.*;


public class ChartGraphics {

BufferedImage image;

public void createImage(String fileLocation) {

try {

FileOutputStream fos = new FileOutputStream(fileLocation);

BufferedOutputStream bos = new BufferedOutputStream(fos);

JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);

encoder.encode(image);

bos.close();

} catch(Exception e) {

System.out.println(e);

}

}


public void graphicsGeneration(int h1,int h2,int h3,int h4,int h5) {


final int X=10;

int imageWidth = 800;//图片的宽度

int imageHeight =900;//图片的高度

int columnWidth=70;//柱的宽度

int columnHeight=800;//柱的最大高度


ChartGraphics chartGraphics = new ChartGraphics();

chartGraphics.image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);

Graphics graphics = chartGraphics.image.getGraphics();

graphics.setColor(Color.white);

graphics.fillRect(0,0,imageWidth,imageHeight);

graphics.setColor(Color.black);
//graphics.setXORMode(Color.blue);
graphics.drawLine(columnWidth+X,columnHeight-h5-50,columnWidth+X,columnHeight);//Y轴

graphics.drawLine(columnWidth+X,columnHeight-h5-50,columnWidth+X-10,columnHeight-h5-40);//Y轴箭头左

graphics.drawLine(columnWidth+X,columnHeight-h5-50,columnWidth+X+10,columnHeight-h5-40);//Y轴箭头右

graphics.drawLine(750,columnHeight,columnWidth+X,columnHeight);//X轴

graphics.drawLine(750,columnHeight,740,columnHeight-10);//X轴

graphics.drawLine(750,columnHeight,740,columnHeight+10);//X轴

graphics.setColor(Color.yellow);

graphics.fillRect(X+1*columnWidth+10, columnHeight-h1, columnWidth, h1);

graphics.fillRect(X+2*columnWidth+20, columnHeight-h2, columnWidth, h2);

graphics.fillRect(X+3*columnWidth+30, columnHeight-h3, columnWidth, h3);

graphics.fillRect(X+4*columnWidth+40, columnHeight-h4, columnWidth, h4);

graphics.fillRect(X+5*columnWidth+50, columnHeight-h5, columnWidth, h5);

//graphics.drawString()

chartGraphics.createImage("D:\\leaderquery\\leaderqueryWeb\\web800\\images\\chart.jpg");

}

}



在百度中搜索:在服务器端动态生成gif or jpg示例
在Google中搜索:在服务器端动态生成gif or jpg示例
在Yahoo中搜索:在服务器端动态生成gif or jpg示例

收藏到网摘:新浪VIVI 365key 我摘 POCO网摘 博采中心 YouNote 和讯网摘 天天收藏
[] [返回上一页] [打 印] [收 藏]

 相关文章    最新文章
· 如何在服务端(Page.Write)调用自定义的JS..
· XSL简明教程(4)在服务器端的实现
· 如何在服务器上保存一定时间的信息
· 如何在服务器端调用winzip命令行对上传的..
 
· 提升JSP页面响应速度的七大秘籍绝招
· 开发一个调试JSP的Eclipse插件
· JSP报表打印的一种简单解决方案
· JSP/Servlet的重定向技术综述
· java的md5加密类(zt)
· 一个用来访问http服务器的东西。功能类似..
· 菜鸟调试手记一(sql server 中文问题)
· Java性能优化技巧集锦(2)
· 用java压缩文件示例(没有中文问题)
· 使用XML/HTC/DHTML模拟标准Windows菜单

∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论…]
站内搜索

精彩图文
  网站导航  
操作系统 办公软件 网络软件
Vista Windows2003 WindowsXP Windows2000/NT Windows9X/ME Linux 其他 Word Excel Powerpoint Outlook 金山系列 其他 网页浏览 上传下载 联络聊天 邮件工具 服务器软件 网络辅助
工具软件 媒体动画 网页制作
系统工具 媒体工具 压缩工具 图文处理 文件管理 其他 3DMAX Authorware Director Maya 视频处理 其他 Flash Dreamweaver FireWorks FrontPage LiveMotion Golive HTML/CSS 其它
网站开发 平面设计 程序设计
ASP JSP PHP CGI JavaScript VBScript XML/SOAP Web服务器 Photoshop PhotoImpact CorelDraw Illustrator Freehand 设计欣赏 其他 VB VC .NET C/C++ DELPHI JAVA

冀ICP备05019428号
Copyright © 2004-2008 电脑学习网 Inc.All rights reserved.
TEL:13832340607
QQ:39873155
E_Mail:goodsgy(#)hotmail.com   (把(#)替换成@)
MSN:goodsgy(#)hotmail.com   (把(#)替换成@)