Setting Icon in Processing 3.x

edited February 2016 in Programming Questions

How does one set the icon for a sketch in Processing 3.x?

For older versions this worked fine:

  PImage astroEQIcon = loadImage("icon.png");
  Image icon = (Image)astroEQIcon.getNative();
  frame.setIconImage(icon);

But in 3.x is does nothing at all.

So at the moment I am stuck between using processing 1.5.1 which mostly works for my program, 2.2.1 for which none of the exported applications actually load, or 3.0 which doesn't seem to set Icons properly and forces me to provide both 32bit and 64bit versions of the exported application because the 32bit one won't load on 64bit windows.

Answers

  • Did you ever figure this out? I can't get icons to work either.

  • @drbogger, nope, gave up with 3.0. I went back to trying 2.2.1 and finally figured out why the exported app wasn't loading with that - my "data/" folder was not being embedded in the jar, so now whenever I export from 2.2.1 I simply rename the .jar to .zip, copy in the data folder manually, and then rename back to .jar. All works fine with the 2.2.1 version then.

  • Hmm.. I wonder why it don't work on Processing 3.x... I'll let u know if I ever figure it out.

  • @TCWORLD, I figured it out!

    This code was tested working with Processing 3.0.2:

    PImage icon = loadImage("icon.png"); surface.setIcon(icon);

  • Aha! Finally an up to date thread!
    Thanks a lot!

Sign In or Register to comment.