how-to

Graphics

How to read image from resources as java.awt.Image instance

When you need read image from project resources and read it directly into java.awt.Image class instance, use this code:

Image image = Toolkit.getDefaultToolkit().getImage( this.getClass().getResource( "/resource/pict2.png" ) );