If all you want to do is display an image, the alternative is to simply load your image as an icon in a JLabel and add that JLabel to the JPanel. If you do it that way, there is no need to subclass JPanel.