Taskbar icon with lwjgl?

I want to add a taskbar icon for my launch of the lwjgl process in Windows 7.

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

What to do?

My code is something like:

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

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

+4
source share
3 answers

This code worked fine for me. No need for additional libraries.

 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); 
+3
source

You should look at the J7Goodies Java library, which provides many of the features of Windows 7.

+2
source

This is what I learned after the mess a few hours later.

I used the slick-util lib library.

 Display.setIcon(new ByteBuffer[] { new ImageIOImageData().imageToByteBuffer(ImageIO.read(new File("res/game/gameIcon.png")), false, false, null), new ImageIOImageData().imageToByteBuffer(ImageIO.read(new File("res/game/gameIcon.png")), false, false, null) }); 
+2
source

Source: https://habr.com/ru/post/1336927/


All Articles