The line
andImg = ImageIO.read(getClass().getResource("gate_and.png"));
fails with
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
I'm using Eclipse and in the navigation view under the bin folder there is the file gate_and.png, suggesting that the file is in the build path.
In the package explorer view I have
project/src/view/class - This is the class that has the code above.
and
project/images/gate_and.png
I right clicked the project folder > build path > link source to add the images folder as a source, doing this again provides a confirmation msg that says images is already in the source.
I have also tried changing gate_and.png to images/gate_and.png and /images/gate_and.png, but since the image gate_and.png is in the bin folder, I think the original is correct.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…