a few questions about JPanel
I'm still working on getting my head around JPanel and JFrame, so I was wondering if the paintComponent can be called on a JPanel inside of a JFrame. I was having some trouble putting a background on the window of my program, and while searching I came across an example that did this:
This of course did not compile for me, though in the author's defense it may be from an old version of Java. It got me thinking however if it would be possible to do something like that, and call a JPanel inside of a JFrame and paint just the panel. I've only used JPanels and JFrames as extensions of classes, I've never used them directly inside of each other.
public class something extends JFrame
JPanel bg = new JPanel()
this.paintComponent( Graphics g )
Image img = new ImageIcon( "image.jpg" ).getImage();
g.drawImage( img, 0, 0, null );