🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2782

Incremental image display

#2782
From: John P. McGrath
Date: Mon, 27 Mar 2000 00:00
56 lines
2561 bytes
Is anyone aware of an intended change made by Sun in the way images are 
displayed?  It appears as if the incremental display of images does not 
work in JDK 1.2 and later.

The following is the code for a component that displays an image:

    class ImageViewer
        extends Panel
    {
        private Image image;

        public ImageViewer( Image image ) {
            this.image = image;
        }

        public void paint( Graphics g ) {
            Dimension size = getSize();
            g.drawImage( image, 0, 0, size.width, size.height, this );
        }
    }

I have tested this in both an application and an applet and I get the 
same results.  It works with JDK 1.1.*, but not with 1.2.* or 1.3.*.  I 
have also tried this with Swing components and see the same behavior.

All of the ImageObserver mechanisms work properly.  The component's 
imageUpdate() method is called multiple times as the image is loaded.  
The default implementation of imageUpdate() does a repaint(), and the 
component's paint() method is called.  But when the paint() method calls 
Graphics.drawImage() on the partially loaded image, it draws nothing 
(with JDK 1.2 and JDK 1.3), even though the docs say that it "Draws as 
much of the specified image as is currently available".

I am assuming that I have done something wrong, since I find it very 
unlikely that there could be such a significant change from one JDK to 
another.  And I find it even stranger that I cannot find a mention of 
this on the Bug Parade, especially this long after the release of JDK 
1.2.

I did find one thread on the Sun "Java Discussion Forums" that described 
the problem exactly as I see it, but there were no responses that 
explained why it was happening.  This thread is at:

    http://forum2.java.sun.com/forum?14@@.ee760aa

I have created a web page that contains the complete source needed to 
demonstrate the problem.  It also contains an applet that you can run.  
The web page is at:

    http://nscs.fast.net/~jpm/ImageTest/ImageTest.html

-- 
John P. McGrath
<JPMcGrath@fast.net>
<jpm@nscs.fast.net>
Technical Details
Message-ID: <MPG.1348eafa88bc8f9498982a@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,9d6287f063ceb23c,start
X-Google-Attributes: gid1089d0,public
From: John P. McGrath <JPMcGrath@fast.net>
Subject: Incremental image display
Date: 2000/03/27
Message-ID: <MPG.1348eafa88bc8f9498982a@forums.borland.com>
X-Deja-AN: 602872953
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.api