wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes Background image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Background image" Watch "Background image" New topic

Background image

Rocky Summers
Ranch Hand

Joined: Nov 07, 2003
Posts: 66
hey guys,
just wondering how i can add a background image in a swing program..
~ rockster
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Rocky, if you search this forum you will find that this question has been asked and answered a LOT. But the gist of it is overriding the paintComponent(Graphics g) method of a Swing component (usually a JPanel) and drawing the image in that method. You can also just place an ImageIcon on a component but you will have problems placing other components on top of that. So the paintComponent is the way to go if you are looking for a wallpaper type of feature.

GenRocket - Experts at Building Test Data
I agree. Here's the link: http://aspose.com/file-tools
subject: Background image
It's not a secret anymore!