I\'m new to graphics in Java and I want to draw an image from my computer. However, the image only shows when I put my code inside the paintComponent. Here\'s what works: