This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Displaying multiple images Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Displaying multiple images" Watch "Displaying multiple images" New topic
Author

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
Trailboss

Joined: Dec 14, 1998
Posts: 19671
    ∞

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 forums
Jayakumar Thirumalai
Greenhorn

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.
Jay

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: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Displaying multiple images
 
Similar Threads
blinking tab pane
GIF image added to JPanel doesn't resize
Image Display Error
Refreshing JLabel
Label not repainting inside method.