本帖最后由 java2000_net 于 2008-06-21 15:40:40 编辑

解决方案 »

  1.   

    import java.awt.Component;
    import java.io.File;
    import java.io.FileInputStream;import javax.swing.ImageIcon;
    import javax.swing.JOptionPane;public class Test {
      /** 
    *  获得图片上的验证码。显示图片,然后让用户输入上面的内容,并返回。释放资源。 
    * @param bs 图形的字节码数组 
    * @return 用户输入的验证码 
    */ 
    public static String getCode(byte[] bs){ 
     
    ImageIcon icon = new ImageIcon(bs,"hello");
    Object ob = JOptionPane.showInputDialog((Component)null, "", "输入验证码", JOptionPane.INFORMATION_MESSAGE, icon,   null,"") ;

    return (String)ob;
    }

    public static void main(String[] args) throws Exception  {
    File file = new File("d:\\test.jpg");
    FileInputStream out = new FileInputStream(file);

    byte[] bs =new byte[ out.available()];

    out.read(bs);
    System.out.println(getCode(bs));
    }
     }写了一个程序 能够实现 竹子你看看 呵呵有什么不符合要求的地方 呵呵
      

  2.   

    只支持 GIF, JPEG,  PNG 格式
      

  3.   

    bs上面写了个
    都不好意思拿出来坍台
    页面显示一张图片,下面一个文本框@(&#(@#&%(@&%()@
    太坍台了
    果然还差得远啊
      

  4.   

    此贴必火 先MARK,等待更多高手发言