I have added the image in the src and bin directories and cross-checked that the name of the image file is correct
Here is the main class
import javax.swing.*;
public class apples
{
    public static void main(String args[])
    {
        JFrame frame = new JFrame();
        MyDrawPanel wid = new MyDrawPanel();
        frame.add(wid);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
        frame.setSize(300,300);
    }
}
and here is the class that does the image adding part
import java.awt.*;
import javax.swing.*;
public class MyDrawPanel extends JPanel 
{
    public void paintComponent(Graphics g)
    {
        Image image = new ImageIcon("b.png").getImage();
        g.drawImage(image,20, 20, this);
    }
}
 
     
     
     
    