Archived

This topic is now archived and is closed to further replies.

cyrax256

[java] Portability of the Icon

Recommended Posts

Hi, I''ve finally done my Uno game I''ve told you in this forum. Because my PC is Windows and I use Solaris at work, I brought my game and tried to run it but appears this exception: Failed to open /resources/UNOHelp.htm Exception in thread "main" java.lang.NullPointerException at sun.awt.motif.MFramePeer.setIconImage(MFramePeer.java:93) at java.awt.Frame.setIconImage(Frame.java:416) at UNOWindow.inictComponents(UNOWindow.java:106) at UNOWindow.(UNOWindow.java:23) at UNOMain.main(UNOMain.java:4) My game has basically two frames, the UNOWindow which has the game, and the UNOHelpScreen, which obviously display a help screen (the help file is in HTML, and it displays it, nothing too fancy). Both these frames load an Icon in the title bar, something that Windows usually does and it has no problem. But in Solaris the title bar does not have a nice icon in the close button, and I think it''s because this the error mentioned above appears. Well, I''d like to know who has found this error and tell me how fixed it. El Ciro

Share this post


Link to post
Share on other sites
What version of Java did you use to develop/test this? What version is one your work machine? (Also keep in mind that if you're using MS J++ it adds some non-standard features which are not supported by true Java [Thats why Sun successfully sued them to stop making it])

[EDIT]: This is just a preliminary guess, I haven't personally look into motif.MFramePeer.setIconImage before.

[edited by - michalson on May 6, 2002 10:01:07 AM]

Share this post


Link to post
Share on other sites
I think that''s the reason. But now I need to recreate the error to tell you good, because I commented the setIconImage lines and everything went allright. :-P

I didn''t know that Sun sued MS for their actions :-P It''s time to tell Microsoft not to insert their own incompatible stuff just to take over a technology :-)

Share this post


Link to post
Share on other sites
Sounds like you attempted to pass a null image to the setIconImage method. Probably the image was not understood by the solaris did you use .ico or .gif? .ico''s may be readable under windows but .gif will work under both.

Share this post


Link to post
Share on other sites
Probably both of those things. 1.3 likely introduces the functionality to load from your filetype, hence 1.2 returns a null pointer (you could insert some error checking to ensure the method returns a valid pointer before using it)

Share this post


Link to post
Share on other sites
quote:
Original post by snowmoon
Sounds like you attempted to pass a null image to the setIconImage method. Probably the image was not understood by the solaris did you use .ico or .gif? .ico''s may be readable under windows but .gif will work under both.




All the images I use are in PNG format (it''s the best things invented since canned jam :-) )

El Ciro

Share this post


Link to post
Share on other sites
BTW, the Uno game is finished :-) (finally, after a Hard Disk format that deleted more than a half of my work :-P), fi you want to check it, download it at http://www.ldc.usb.ve/~ciro/uno/uno.jar (1.8Mb)

Quite simple, download it, if you have Windows just double click it (provided you have installed the Java Runtime Environment 1.3.1 or later), or if you have any UNIX, run the console and type in the directory you downloaded the file: java -jar uno.jar

If Windows downloads you the file as uno.jar.zip, rename it to uno.jar

Share this post


Link to post
Share on other sites