把图片放到你的类所在的目录下就可以了,我编译试过了,可以的。还听漂亮的button,还有鼠标动作,^_^

解决方案 »

  1.   

    下面是我自己的代码,你自己改一下吧,不好意思!
    public static ImageIcon createImageIcon(String filename, String description)
        {
            String path = "/resources/images/" + filename;
            return new ImageIcon((GlobeUnit.class).getResource(path));
        }
      

  2.   

    ImageIcon img = new ImageIcon(ClassLoader.getSystemResource ("button1.gif"));
    //如上,如果有包的话,要把包也加上!!