Skip to main content

Image.scaled() causing NPE?

1 reply [Last post]
nafs
Offline
Joined: 2008-06-10

com.sun.lwuit.Image.createImage( "\mypic.png") works fine.

But, com.sun.lwuit.Image.createImage( "\mypic.png").scaled() doesn't work. Very strange. Here is the stack trace...

java.lang.NullPointerException
at com.sun.lwuit.Implementation.numColors(+3)
at com.sun.lwuit.Display.numColors(+7)
at com.sun.lwuit.Image.scaleArray(+35)
at com.sun.lwuit.Image.scale(+54)
at com.sun.lwuit.Image.scaled(+42)

The same can be said for RGBImage (though admittedly, you do mention in the javadoc that in case RGBImage NPEs are to be expected).

However IndexImage.scaled is working.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chen

Hi,
Please verify you call to Display.init() method first.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> com.sun.lwuit.Image.createImage( "\mypic.png") works fine.
>
> But, com.sun.lwuit.Image.createImage( "\mypic.png").scaled() doesn't work. Very strange. Here is the stack trace...
>
> java.lang.NullPointerException
> at com.sun.lwuit.Implementation.numColors(+3)
> at com.sun.lwuit.Display.numColors(+7)
> at com.sun.lwuit.Image.scaleArray(+35)
> at com.sun.lwuit.Image.scale(+54)
> at com.sun.lwuit.Image.scaled(+42)
>
> The same can be said for RGBImage (though admittedly, you do mention in the javadoc that in case RGBImage NPEs are to be expected).
>
> However IndexImage.scaled is working.
> [Message sent by forum member 'nafs' (nafs)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279353
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net