App Icon Processing 4

I’m trying to set the icon for the application (and in the task bar) in Processing4, and I have this:

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

The image is 778x758; it doesn’t show up though in the program or task bar, so I’m not sure what to do here as this is the documentation:
https://processing.github.io/processing-javadocs/core/processing/core/PSurface.html#setIcon-processing.core.PImage-

Update, I’m using P2D and it appears to work for JAVA2D , however, it’s far too laggy for my image intense program and I need to use P2D… so, still not sure of the solution, but it appears that P2D is the issue here?

hi @Edenstudent,

there are restrictions on setting an icon for JOGL context and therefore it needs to be setup in settings instead of setup method…

Try this…

void settings() {
  size(500,500,P2D);
  PJOGL.setIcon(dataPath("icon.png"));
}

usually if you do this…

void setup() {
    size(500,500,P2D);
    surface.setIcon(loadImage("icon.png"));
}

… you should see an error message like below in the console output !?

Window icons for OpenGL sketches can only be set in settings()
using PJOGL.setIcon(filename).

Cheers
— mnse

3 Likes

Awesome, thanks so much, this worked perfectly!
And no, it didn’t throw any errors or warnings, just did nothing.

Hello @Edenstudent,

This is what I see with Processing 4.3 on W10:

Setting icon in settings():

How cool is that!

:)

1 Like

Oh, my mistake; I thought you meant warning in the errors list, not the console. It fills up so quickly when starting that I must’ve missed it, sorry