The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Matt Gerrans on December 22, 2001 at 2:46 PM

> If I have the following:
> Toolkit.getDefaultToolkit().getImage("C:\\dir\\picture.bmp");
> How can I then Display it on the screen?
> Thank you.

You can look at the
Overview of Custom Painting to learn how to draw images on JPanels, but you have a more fundamental problem to address first: ToolKit.getImage() only supports GIF, JPEG or PNG file formats. So you either have to convert your BMP files to one of these, or find some third-party tool that reads BMPs in to Images (maybe Microsoft has a class for this, but it may also require their JVM).

- mfg


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us