File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes How to set a Background that not stretch? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to set a Background that not stretch?" Watch "How to set a Background that not stretch?" New topic
Author

How to set a Background that not stretch?

Fredrik Andersson
Ranch Hand

Joined: May 03, 2005
Posts: 35
Hello!

I'm trying to set a background image in a app with some code like:

Image2D backgroundImage2D = new Image2D( Image2D.RGB, backgroundImage );
background.setImage(backgroundImage2D);

In paint I paint it like:
graphics3D.bindTarget(g);

try
{
graphics3D.clear(background);
graphics3D.render(world, worldTransform);
}
finally
{
graphics3D.releaseTarget();
}

But the problem is that the image is stretched over the screen. I would like it to stay in center and not be stretched.

So if you guys got any ideas please let me know.

Best regards
Fredrik


Best regards<br />Fredrik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set a Background that not stretch?
 
Similar Threads
Creating a 'background'
awt
How to set image as background of JTree component
Java2D question.: How can you superimpose an image on another?
Painting an image on a button