cannot display Image

后端 未结 1 351
执念已碎
执念已碎 2021-01-17 04:28

I\'m new being in programming, can you please tell me what is the problem in my code. The fillOval is operating well but trying to replace it with .gif file get fai

相关标签:
1条回答
  • 2021-01-17 04:58

    i'm not sure where your problem is, but my very best guess would be:

    your image location is not suitable! (ignore the other classes, it's just a test project ^^)

    i've copy/pasted your code, i used my custom image and it works fine with me!

    location of image

    make an folder in your eclipse project BUT NOT IN YOUR SOURCE dir (!!!) and then refer to the image like this:

    Image img1 = Toolkit.getDefaultToolkit().getImage("img/index.png");
    
    0 讨论(0)
提交回复
热议问题