How to change icon appearing on the taskbar?

Is there any way to change how the icon appearing for each application?
Attached picture shows I have 4 different applications developed with Ignition. I want it to be different so users won’t be frustrating looking for the right application to work with when they have multiple (Ignition) applications open at the same time.

Even though the launch icon has been set in Project Properties and the desktop icons are different, when launched, they’re all the same on taskbar.

This was fun, too. Try this: Add a hidden image component to your window and load your icon image into it. Then put this code in your window internalFramedOpened event:

from java.awt import Frame

win = system.gui.getParentWindow(event)
img = win.rootContainer.getComponent("Image")
parent = win
while parent is not None:
   win = parent
   parent = win.getParent()
win.setIconImage(system.print.createImage(img))

adamaustin,
Thank you very for the response.

It seems to work but the image is not loaded (png image is uploaded into Image Management).

What I did was,

  • add image component and set image path to the image
  • uncheck the visible properties of the image
  • append your code to the mentioned event

I print out ‘win’ before the setIconImage and it gives me this.

javax.swing.JFrame[frame0,-8,-8,1936x1176,invalid,layout=java.awt.BorderLayout,title=Configuration Editor Development - OPERATIONS,resizable,iconified,maximized,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=javax.swing.JRootPane[,8,31,1920x1137,invalid,layout=com.incors.plaf.alloy.bk,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

I spot a couple of invalid words but not sure what it really means.
Can you shed some light please?

I tried uploading my own PNG and it worked fine for me.
I get similar when I print ‘win’ so I’m sorry it’s not working for you.

javax.swing.JFrame[frame0,-9,-9,1938x1028,invalid,layout=java.awt.BorderLayout,title=TestProject (STAGING),
resizable,maximized,defaultCloseOperation=DO_NOTHING_ON_CLOSE,
rootPane=javax.swing.JRootPane[,9,38,1920x981,invalid,layout=com.incors.plaf.alloy.bk,alignmentX=0.0,alignmentY=0.0,
border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

‘Support people’…
Any suggestion how to fix this?
The operators in our plant are also getting frustrated by this.

Try it this way.

[code]from javax.imageio import ImageIO
from java.net import URL

url16 = URL(“http://localhost:8088/main/system/images/Builtin/icons/16/add2.png”)
url32 = URL(“http://localhost:8088/main/system/images/Builtin/icons/32/add2.png”)
url48 = URL(“http://localhost:8088/main/system/images/Builtin/icons/48/add2.png”)

icons = []
icons.append(ImageIO.read(url16))
icons.append(ImageIO.read(url32))
icons.append(ImageIO.read(url48))

win = system.gui.getParentWindow(event)
parent = win
while parent is not None:
win = parent
parent = win.getParent()
win.setIconImages(icons)[/code]

1 Like

script from Jae works.
Thanks

After upgraded to 7.7, the above script didn’t work. Jae helped me get around by providing this script to me.
Forgot to mention that, put this script under visionWindowOpened event

from javax.imageio import ImageIO
from java.net import URL
from javax.swing import JFrame
from org.python.core import Py

url16 = URL(“http://localhost:8088/main/system/images/Builtin/icons/16/add2.png”)
url32 = URL(“http://localhost:8088/main/system/images/Builtin/icons/32/add2.png”)
url48 = URL(“http://localhost:8088/main/system/images/Builtin/icons/48/add2.png”)

icons = []
icons.append(ImageIO.read(url16))
icons.append(ImageIO.read(url32))
icons.append(ImageIO.read(url48))

win = system.gui.getParentWindow(event)
while not isinstance(win,JFrame):
win = win.getParent()
javaWin = Py.tojava(win,JFrame)
javaWin.setIconImages(icons)

Worked like a charm.
Thank you for sharing.

Just retyping the code in a code snippet to keep the indentations.

from javax.imageio import ImageIO
from java.net import URL
from javax.swing import JFrame
from org.python.core import Py

url16 = URL("http://localhost:8088/main/system/images/Builtin/icons/16/add2.png")
url32 = URL("http://localhost:8088/main/system/images/Builtin/icons/32/add2.png")
url48 = URL("http://localhost:8088/main/system/images/Builtin/icons/48/add2.png")

icons = []
icons.append(ImageIO.read(url16))
icons.append(ImageIO.read(url32))
icons.append(ImageIO.read(url48))

win = system.gui.getParentWindow(event)
while not isinstance(win,JFrame):
	win = win.getParent()
javaWin = Py.tojava(win,JFrame)
javaWin.setIconImages(icons)