title: jbutton id not showing
body: <p>I just created a simple imagepanel and add a button on the panel </p>
  
  <p>Can any body tell me wats the problem in code?</p>
  
  <p>Image is displaying but button is not</p>
  
  <pre><code>package inventorymanagement;
  
  import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.Image;
  import javax.swing.JButton;
  import javax.swing.ImageIcon;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  
  public class ImageTest {
  
  public static void main(String[] args) {
  ImagePanel panel = new ImagePanel(new ImageIcon("E:/Desktop[/icon/6470729-exclamation-mark-icon-button-3d-red-glossy-circle.jpg").getImage());
  JButton jButton1=new JButton("jButton1");
  panel.add(jButton1);
  
  JFrame frame = new JFrame();
  frame.getContentPane().add(panel);
  frame.pack();
  frame.setVisible(true);
  
  }
  }
  
  class ImagePanel extends JPanel {
  
  private Image img;
  public ImagePanel(String img) {
  this(new ImageIcon(img).getImage());
  }
  
  public ImagePanel(Image img) {
  this.img = img;
  Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
  setPreferredSize(size);
  setMinimumSize(size);
  setMaximumSize(size);
  setSize(size);
  setLayout(null);
  }
  
  
  
  public void paintComponent(Graphics g) {
  g.drawImage(img, 0, 0, null);
  }
  
  }
  </code></pre>