当前位置: 代码迷 >> Java Web开发 >> jsp画图
  详细解决方案

jsp画图

热度:479   发布时间:2008-10-15 02:00:58.0
jsp画图
<%@ page language="java" contentType="text/html; charset=gbk"
    pageEncoding="gbk" import="javax.imageio.*,java.awt.*,java.awt.image.*"%>
<%
    int width=400;
    int height=400;
    BufferedImage image=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
    
    Graphics g=image.getGraphics();
    g.setColor(Color.red);
    g.drawLine(20,20,220,20);
    g.setColor(Color.white);
    g.dispose();
    ImageIO.write(image,"jpg",response.getOutputStream());
    out.clear();
    out = pageContext.pushBody();     
%>

背景色是漆黑的,怎么设置背景色
搜索更多相关主题的帖子: 画图  jsp  

----------------解决方案--------------------------------------------------------
解决了

g.setColor(Color.white);
g.fillRect(0,0,width,height);
----------------解决方案--------------------------------------------------------
  相关解决方案