Ok Question, I have a GameBoard class(JPanel) which allows me to ingegrate w.e maps I want and w.e sprites to be loaded onto it, then this is put onto my JFrame class. For my GameBoard Class I painted a Custom image onto the JPanel by:
public void paint(Graphics g) {
super.paint(g);
bg = new ImageIcon("Trees!.png").getImage();
g.drawImage(bg, 0,0,null);
Graphics2D g2d = (Graphics2D)g;
2d.drawImage(spO.getImage(), spO.getX(), spO.getY(), this);
Toolkit.getDefaultToolkit().sync();
g.dispose();
}
Question is, when I try to add a JLabel or JButton onto this GameBoard It keeps getting painted behind the Image. The reason I know this is If I don’t paint an Image via commenting out g.drawImage(bg, 0,0,null); I get a regular background (blue) and my buttons and lables are there, so how do I make this Image the standard panes image?
All Help is appreciated thanks.