You must create ImageIcon as follows:
new ImageIcon ( MWindow31Pic.class.getResource ( "close.jpg" ) )
Because in his own way:
new ImageIcon ( "close.jpg" )
the image must be inside the working directory of the application, but not inside the package of the calling class.
You can also move images to a separate folder:
new ImageIcon ( MWindow31Pic.class.getResource ( "images/close.jpg" ) )
source share