i have a simple paint component method to display an image middle of the frame.
public void paintComponent(Graphics g)
g.drawImage(img.getImage(),(this.getWidth()-img.getIconWidth())/2,(this.getHeight() - img.getIconHeight())/2,null);
This method is called when a menu item is clicked and drawn into a panel. The picture doesnt appear immediately when the menu option is clicked. It appears only when i resize the frame. The other problem is that when i resize the frame the picture gets displayed in the new center with the old one still remaining. How do i remove the old one and make the picture appear when i click the menu option itself.