File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Displaying multiple images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Displaying multiple images" Watch "Displaying multiple images" New topic

Displaying multiple images

Bill Compton
Ranch Hand

Joined: Aug 26, 2000
Posts: 186
The application is to display a geographic map from a .gif and then draw vectors on top to show locations of features. Then the user can change the geographic location. A GIS will generate a new map .gif which must be read and displayed. The task of this code then is to show loading an image and then replacing with another image. The behavior (with Java 1.2 and 1.3) is that the first image is loaded and displayed but when it tries to replace the first image with the second image, the window does not change.
Can anyone correct my approach?
Thanks in advance.

[This message has been edited by Paul Wheaton (edited September 18, 2000).]
paul wheaton

Joined: Dec 14, 1998
Posts: 20965

I put a slash in your CODE statement so it could be more readable.

I think the problem is that you are using the thread that the VM needs to draw stuff.

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Jayakumar Thirumalai

Joined: Jul 08, 2000
Posts: 15
You may try
jframe.validate(); before repaint().
if you want the second image to overlap on first image, you may have to remove the icon from panel also.
You may also increase the sleep time from 3000 to 5000 or 6000. This will give some time for the image to load.

Jayakumar Thirumalai
Bill Compton
Ranch Hand

Joined: Aug 26, 2000
Posts: 186
The solution I have settled on is to invoke drawImage directly in the paint() method of the container. Thanks for the suggestions / help. Here's the skeleton that works:
I agree. Here's the link:
subject: Displaying multiple images
It's not a secret anymore!