[3536] in java-interest

home help back first fref pref prev next nref lref last post

Simple Draw Image

daemon@ATHENA.MIT.EDU (Brian D. Elliott)
Wed Nov 15 20:13:54 1995

Date: Wed, 15 Nov 1995 12:47:55 -0800 (PST)
From: "Brian D. Elliott" <belliott@world.nad.northrop.com>
To: java-interest@java.sun.com


I am having a major flicker problem drawing a very simple gif file. This
applet seems so simple - what am I doing wrong? Do I have to use a panel 
or a canvas to draw to? It also takes a long time to display.

If I use the NoFlickerApplet from the net(mkgray), it doesn't flicker but
it still takes a long time to display the image. This applet draws the 
image off screen first.

Here is my code:

import java.awt.*;
import java.applet.*;
import java.awt.image.*;
import sun.awt.image.URLImageSource;


public class MapTest extends Applet {

    private Image joe = null;

    public void init() {
 		joe = getImage(getDocumentBase(), "world.gif");
    }

   public void paint(Graphics g) {
		if (joe != null) {
  		  g.drawImage(joe, 0, 0, 708, 386, this);
      }

   }
}


=========================================================================
Brian Elliott                          | 310-948-7038
Northrop Grumman Corp.                 |
belliott@world.nad.northrop.com        |
=========================================================================


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post