Background picture?

May I know how can I have a background using picture?
[67 byte] By [totitan] at [2007-9-26 1:22:23]
# 1
Hi totitan!Be a little more specific. Where do you want a backg picture? Should it be something special? Any functions?CUL8er,Nick.
nikolaosb at 2007-6-29 0:59:21 > top of Java-index,Archived Forums,Swing...
# 2

Hi there!

Might want to check the Java Tutorial, which explains how to do it.

Here's how I did it recently in a JWindow (it's the same for any container):

public class SplashScreen extends JWindow {

public SplashScreen() {

BackgroundPanel bp = new BackgroundPanel();

bp.setLayout(new BorderLayout());

getContentPane().add("Center", bp);

}

public class BackgroundPanel

extends Container {

Image background;

public BackgroundPanel() {

URL u = ClassLoader.getSystemResource(

"images/Splash.jpg");

background = Toolkit.getDefaultToolkit().getImage(u);

}

public void paint(Graphics g) {

g.drawImage(background, 0, 0, this);

super.paint(g);

}

public void update(Graphics g) {

paint(g);

}

}

Eric.Vautier at 2007-6-29 0:59:21 > top of Java-index,Archived Forums,Swing...
# 3
OIC I think maybe I forgot to put in the super.paint(g), thats why the buttons didn't come out.
totitan at 2007-6-29 0:59:21 > top of Java-index,Archived Forums,Swing...
# 4
thanx a lot both of you are indeed a great help =)
totitan at 2007-6-29 0:59:21 > top of Java-index,Archived Forums,Swing...