Get image from relative path

前端 未结 8 1988
囚心锁ツ
囚心锁ツ 2021-02-03 13:01

In my project I have 2 packages. images - contain images and notification - contain java files

In notification/main.java I get Image o

8条回答
  •  渐次进展
    2021-02-03 13:16

    Incase the solution above doesn't work, try this (which worked for me):

    Image image = Toolkit.getDefaultToolkit().createImage(this.getClass().getResource("/Images/bell-icon16.png"));
    

提交回复
热议问题