NullPointerException with JWidgets 3.0 and Netscape 4.04

Article ID: 880
Last updated: 05 Feb, 2008
Article ID: 880
Last updated: 05 Feb, 2008
Revision: 1
Views: 3685
Posted: 01 Dec, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


A NullPointerException is thrown when an image is accessed in Netscape 4.x when using the getResource() method, JWidgets 3.0, and the JDK 1.1.


Cause


This could be a bug in Netscape 4.x and currently there is no patch for it.


Action


Do the following:

  1. Place the image in a Jar File.

  2. Use the getResourcesAsStream() instead of the getResource()method.

    Example:

    byte[] contents = null;

    in = new DataInputStream(getClass().getResourceAsStream(resources/forward.gif)); contents = new byte[in.available()]; in.read(contents); ImageButton myButton = new ImageButton(new SerializableImage(contents)); add(myButton);

This article was:   Helpful | Not helpful
Report an issue
Article ID: 880
Last updated: 05 Feb, 2008
Revision: 1
Views: 3685
Posted: 01 Dec, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category