j**a 谁能给我画图组成的股市分析代码?
安徽省寿县绿恋草坪有限公司
2024-11-30 08:53:19
最佳回答
package com.hbsoft; import j**a.awt.color; import j**a.awt.graphics; import j**a.awt.image.bufferedimage; import j**a.io.ioexception; import j**a.io.printwriter; import j**a.util.hashset; import j**a.util.iterator; import j**a.util.random; import j**ax.imageio.imageio; import j**ax.servlet.servletexception; import j**ax.servlet.http.httpservlet; import j**ax.servlet.http.httpservletrequest; import j**ax.servlet.http.httpservletresponse; import j**ax.servlet.http.httpsession; public class captchaservlet extends httpservlet { public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { th**.dopost(request, response); } public void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setheader("pragma","no-cache"); response.setheader("cache-control","no-cache"); response.setheader("expires","0"); response.setcontenttype("image/jpeg"); bufferedimage image = new bufferedimage(100,20,bufferedimage.type_int_rgb); graphics g = image.getgraphics(); random random = new random(); g.setcolor(color.pink); g.fillrect(0,0,100,80); int[] m = new int[4]; string[] str = new string[4]; for(int i = 0; i < 4; i ++){ m[i] = random.nextint(10); system.out.println(m[i]); } for(int i = 0; i < 4; i ++){ int itemp = random.nextint(26) + 65; char temp = (char)itemp; str[i] = string.valueof(temp); system.out.println(str[i]); } string strx = ""; for(int i = 0; i < 4;i++){ strx = strx + str[i] + m[i]; } hashset hs = new hashset(); for(int i = 0;i < 8; i++){ hs.add(string.valueof(strx.charat(i))); } iterator ite = hs.iterator(); string strmm = ""; while(ite.hasnext()){ strmm = strmm + ite.next(); } system.out.println(strmm); g.setcolor(color.white); g.drawstring(""+strmm, 10,10); httpsession session = request.getsession(); session.setattribute("hand",strmm); imageio.write(image, "jpeg",response.getoutputstream()); } }采纳哦 20210311