I have overridden the paintComponent method in a class which extends JPanel but the JPanel will not display anything I have created in the paintComponent method. Here is the code im using -
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(Color.black);
g.drawRect(100, 100, 50, 50);
}
Has anyone got any idea why the rectangle is not displaying on my JPanel, do I have to make a call to the paintComponent method?