Null pointer exception with Java 1.4.2, ok with 1.5
From: Luke (lukeita_at_gawab.com)
Date: 11/27/04
- Next message: Bill_Richie: "OOP question. Are these Objects right?"
- Previous message: PerfectDayToChaseTornados: "Re: loading a servlet in a frame.."
- Next in thread: Andrew Thompson: "Re: Null pointer exception with Java 1.4.2, ok with 1.5"
- Reply: Andrew Thompson: "Re: Null pointer exception with Java 1.4.2, ok with 1.5"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 27 Nov 2004 12:05:14 GMT
HellO!
I'm working on an image applet, and I've developed an object from
JPanel to show images... this is the simple code:
---
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
class JImagePanel extends JPanel
{
private BufferedImage image;
public void setImage(BufferedImage i)
{
image = i;
}
public void paintComponent(Graphics g)
{
g.drawImage(image,0,0,this);
}
}
---
With Java 1.5 works fine, with 1.4.2 I get a Null pointer exception,
which could be the problem?
Thanks
(follows the complete error I see on Java console)
---
java.lang.NullPointerException at
sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at
sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at
sun.java2d.SunGraphics2D.drawImage(Unknown Source) at
sun.java2d.SunGraphics2D.drawImage(Unknown Source) at
JImagePanel.paintComponent(JImagePanel.java:16) at
javax.swing.JComponent.paint(Unknown Source) at
javax.swing.JComponent.paintChildren(Unknown Source) at
javax.swing.JComponent.paint(Unknown Source) at
javax.swing.JComponent.paintChildren(Unknown Source) at
javax.swing.JComponent.paint(Unknown Source) at
javax.swing.JComponent.paintChildren(Unknown Source) at
javax.swing.JComponent.paint(Unknown Source) at
javax.swing.JLayeredPane.paint(Unknown Source) at
javax.swing.JComponent.paintChildren(Unknown Source) at
javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source) at
javax.swing.JComponent.paintDoubleBuffered(Unknown Source) at
javax.swing.JComponent.paint(Unknown Source) at
java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at
sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at
sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at
java.awt.Container.paint(Unknown Source) at
sun.awt.RepaintArea.paint(Unknown Source) at
sun.awt.windows.WComponentPeer.handleEvent(Unknown Source) at
java.awt.Component.dispatchEventImpl(Unknown Source) at
java.awt.Container.dispatchEventImpl(Unknown Source) at
java.awt.Component.dispatchEvent(Unknown Source) at
java.awt.EventQueue.dispatchEvent(Unknown Source) at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at
java.awt.EventDispatchThread.pumpEvents(Unknown Source) at
java.awt.EventDispatchThread.run(Unknown Source)
- Next message: Bill_Richie: "OOP question. Are these Objects right?"
- Previous message: PerfectDayToChaseTornados: "Re: loading a servlet in a frame.."
- Next in thread: Andrew Thompson: "Re: Null pointer exception with Java 1.4.2, ok with 1.5"
- Reply: Andrew Thompson: "Re: Null pointer exception with Java 1.4.2, ok with 1.5"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|