java - Add images to JButton in Eclipse -


i new programmer , have started using eclipse. previously, used jgrasp , when wanted add image button did create image folder within class's folder , write:

seticon(newimageicon(this.getclass().getresource("/images/name.png")));

i tried same thing eclipse main:nullpointerexception error.
read post , added source folder project named images nothing changed. following code segment have issue with:

resetbutton.seticon(newimageicon(this.getclass().getresource("/images/helpicon.png")));

you on right way. had added resource folder. additional root resources. here, in folder (as root) have create /image folder , put files it:

enter image description here


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -