驗(yàn)證碼校驗(yàn)
g.drawString(ch[index]+"",?i*15+3,?18);
這句代碼一直報(bào)錯(cuò),為什么
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
g.drawString(ch[index]+"",?i*15+3,?18);
這句代碼一直報(bào)錯(cuò),為什么
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
2016-12-08
舉報(bào)
2016-12-10
在MyEclipse中的配置方式為:右擊項(xiàng)目->configuration buildPath->選擇jre8->remove->add library->JRE SystemLibrary->jre6。這樣就能解決嘿嘿
2016-12-10
我也遇到了,唉
2016-12-08
BufferedImage bi=new BufferedImage(68, 32, BufferedImage.TYPE_INT_BGR);
?? ??? ?
?? ??? ?Graphics g=bi.getGraphics();
?? ??? ?
?? ??? ?Color c=new Color(200,150,255);
?? ??? ?
?? ??? ?g.setColor(c);
?? ??? ?
?? ??? ?g.fillRect(0, 0, 68, 32);
?? ??? ?
?? ??? ?char[] ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();
?? ??? ?
?? ??? ?Random r=new Random();
?? ??? ?
?? ??? ?int len=ch.length,index;
?? ??? ?
?? ??? ?StringBuffer sb=new StringBuffer();
?? ??? ?
?? ??? ?for(int i=0;i<4;i++){
?? ??? ??? ?index=r.nextInt(len);
?? ??? ??? ?g.setColor(new Color(r.nextInt(79),r.nextInt(135),r.nextInt(202)));
?? ??? ??? ?
?? ??? ??? ?g.drawString(ch[index]+"", (i*15)+3, 18);
?? ??? ??? ?
?? ??? ??? ?sb.append(ch[index]);
?? ??? ?}
?? ??? ?request.getSession().setAttribute("piccode", sb.toString());
?? ??? ?
?? ??? ?ImageIO.write(bi, "JPG", response.getOutputStream());
?? ????