Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Displaying multiple images

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Trailboss
Posts: 23212
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Jay
 
Bill Compton
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic