How to set background image in Java?
Posted
by Dew
on Stack Overflow
See other posts from Stack Overflow
or by Dew
Published on 2009-02-07T13:30:44Z
Indexed on
2010/04/01
5:23 UTC
Read the original article
Hit count: 255
I am developing a simple platform game using Java using BlueJ as the IDE. Right now I have player/enemy sprites, platforms and other items in the game drawn using polygons and simple shapes. Eventually I hope to replace them with actual images.
For now I would like to know what is the simplest solution to setting an image (either URL or from local source) as the 'background' of my game window/canvas?
I would appreciate it if it isn't something long or complex as my programming skills aren't very good and I want to keep my program as simple as possible. Kindly provide example codes with comments to elaborate on their function, and also if it's in its own class, how to call on relevant methods used by it on other classes.
Thank you very much.
© Stack Overflow or respective owner