Taskbar icon with lwjgl?

Hugh Perkins picture Hugh Perkins · Jan 25, 2011 · Viewed 7.5k times · Source

I want to add a taskbar icon for my running lwjgl process on Windows 7.

Display.setIcon changes successfully the icon in the topleft of the window, but not in the taskbar.

What do to?

My code, something like:

ArrayList<ByteBuffer> byteBuffers = new ArrayList<ByteBuffer>();
byteBuffers.add( ImageHelper.loadImageAsIconImage("stickmanicon32x32.png") );
byteBuffers.add( ImageHelper.loadImageAsIconImage("stickmanicon16x16.png") );
System.out.println( "taskbaricon result: " + Display.setIcon(byteBuffers.toArray(new ByteBuffer[]{})) );

I tried adding a 40x40 image too, but no change.

Answer

MxR picture MxR · Sep 8, 2012

This code worked just fine for me. No need of extra libs.

ByteBuffer[] list = new ByteBuffer[2];
list[0] = createBuffer(ImageIO.read(new File("src/Images/Tests/icon16.png")));
list[1] = createBuffer(ImageIO.read(new File("src/Images/Tests/icon32.png")));
Display.setIcon(list);