Re: J2ME MIDP1 CreateImage problem

From: Darryl L. Pierce (mcpierce_at_myrealbox.com)
Date: 07/17/04


Date: Fri, 16 Jul 2004 21:36:07 -0400

Steven J Sobol wrote:

> 2. There seems to be a scope issue. If I put the createImage calls in
> the constructor or the init() method, when paint() or another method tries
> to use the images in a call to drawImage, I get a null pointer exception.
> (This despite the fact that the Image objects are NOT set up using private
> variables; they're class members.)
>
> Putting the call to createImage inside the paint() method results in the
> images being drawn as they are supposed to be drawn.
>
> I've tried setting the class members containing the Image objects as
> private, protected and public; as static and non-static - and unless the
> createImage call exists within the paint() method and not in some other
> method, the midlet does not work.

It is *not* a scope issue. It is a clear bug in your code for creating your
instances of Image. Please post the full source code as is and I'll be glad
to help you with it.

-- 
Darryl L. Pierce <mcpierce@myrealbox.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"Lobby, lobby, lobby, lobby, lobby, lobby, lobby, lobby..."


Relevant Pages

  • Re: Applet Crashes on Firefox.
    ... answer than that you need to provide some source code. ... Is this error comming in PAINT() function of applet? ... Then I can search the paintcode and find which String is searched at ...
    (comp.lang.java.programmer)
  • Re: ********************** R.I.P. Microsoft ********************
    ... That the largest single block of Code was ... MSPaint and the rest was somewhat random. ... MS Paint is more like 332 KB. ... > 658 MB of source code for MS Paint? ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: ********************** R.I.P. Microsoft ********************
    ... >and the majority of files are from Microsoft Paint. ... >dodge some Paint filled balloons..... ... 658 MB of source code for MS Paint? ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Image editor
    ... Try Paint .NET. ... It is a full image editor with complete source code. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How boot FC 5 to plain TTY terminal mode?
    ... mind being heckled for not upgrading ... paint a target on myself). ... from source code and install other things from source, ...
    (linux.redhat)