Article View: borland.public.jbuilder.java.language
Article #17900Doubble buffering in a canvas.
From: Martin Fuente
Date: Fri, 18 Sep 1998 00:00
Date: Fri, 18 Sep 1998 00:00
28 lines
1137 bytes
1137 bytes
I have a NullPointerException error when the program executes the "g =
imagen.getGraphics()" sentence
in the constructor. This is not an applet. It's an application.
I tried this code alone with an Init method and occured the same error.
Can anybody help me with this?
thank you very much.
import java.io.*;
import java.awt.*;
import java.awt.Graphics;
public class MarcaGeneralCanvas extends Canvas {
int fila, width, height;
Image imagen;
Graphics g;
public MarcaGeneralCanvas(Marca marca) {
imagen = this.createImage(400, 400);
g = imagen.getGraphics();
.......
}
public void paint (Graphics g2) {
g2.drawImage(Imagen,.....)
.. ...
}
Technical Details
Message-ID:
<6ttqkl$ao64@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a7d917cc0ce6dd31,start X-Google-Attributes: gidf74b3,public From: "Martin Fuente" <sistemas@gbreuer.com.ar> Subject: Doubble buffering in a canvas. Date: 1998/09/18 Message-ID: <6ttqkl$ao64@forums.borland.com> X-Deja-AN: 392415515 Organization: G. Breuer X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Newsgroups: borland.public.jbuilder.java.language