I wanted to know that is it possible to change the background of a frame and put an tiled image as the background instead? If yes, then how??

Recommended Answers

All 2 Replies

setBackground() might take an image object as one of it's parameters, but I don't know. If not, in the paint method you could use drawImage().

Hi everyone,

Yes, it is possible to do this.

See the below threads for sample codes and examples

http://javaboutique.internet.com/tutorials/Java2D/page03.html

http://www.raditha.com/java/swing/


This is another good tiling class

http://www.cs.bham.ac.uk/~mdr/teaching/modules04/java2/solutions/TilesGame/AidanHarding/ex3/TiledImage.java

This tiling class extends JPanel but you simply convert it to a JFrame

http://users.erols.com/ziring/java-src/JTiledPanel.java

I hope this helps you

Richard West

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.