An easier way to display an image is as an ImageIcon set to a JLabel. If you really need to use a JPanel and a paintComponent(...) override, try loding the image using ImageIO#read(...) which blocks until the image is fully read from file, unlike the Toolkit method used by ImageIcon to load the image.

All else aside, it's rather silly to construct an ImageIcon just to extract its image when there are other classes (ImgeIO, Toolkit) which have methods to load an image without incurring the overhead of ImageIcon.