I'm trying to make my panel show image as background. I already can do that in NetBeans, but when I build my jar and run it image doesn't show there. I know I have to access it differently. I have seen many tutorials but every one of them shows how to do it with ImageIcon, but I don't need that, I need just Image. Can anyone point out what piece of code do I need to do this? Thanks.
This is my code for backgrounded JPanel:
public class JPanelWB extends JPanel { // Creates JPanel with given image as background.
    private Image backgroundImage;
    public JPanelWB(String fileName){
        try {
            backgroundImage = ImageIO.read(new File(fileName));
        } catch (IOException ex) {
            new JDialog().add(new Label("Could not open image."+ex.getMessage()));
        }
    }
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        // Draw the background image.
        g.drawImage(backgroundImage, 0, 0, getWidth(),getHeight(),this);
    }
}
 
     
    