Icons not being displayed

I’ve read wiki pages, searched this forum and this code feels like it should work but the icons are not being dislayed in the application toolbar or the alt-tab bar.

The icons are PNG and the resolutions.

Any suggestions?

Best regards

public static void main(String[] args) {

    Main app = new Main();

    /* URLs to the icons */    
    java.net.URL url0 = app.getClass ().getResource ("icon16.png");
    java.net.URL url1 = app.getClass ().getResource ("icon32.png");
    java.net.URL url2 = app.getClass ().getResource ("icon128.png");
    java.net.URL url3 = app.getClass ().getResource ("icon256.png");
    /* instatiate AppSettings */
    AppSettings setting = new AppSettings(true);
    setting.setResolution(640, 480);
    setting.setTitle("My app name");
    setting.setFrameRate(60); 
        
    try {
    
        /* create a BufferedImage array */        
        BufferedImage bi[] = {ImageIO.read(url0),
                              ImageIO.read(url1),
                              ImageIO.read(url2),
                              ImageIO.read(url3)};
        
        /* set icons */    
        setting.setIcons(bi); 
    } 
    catch (IOException ex) {
            
       System.err.println (ex.getMessage());
    }
        
    app.setSettings(setting);
    app.setShowSettings(false);
        
    app.start();
}

I’m using Ubuntu and Lubuntu by the way,

does this test case work?

Thanks for your reply.

Repaired an old Win XP machine to test with :-/

Icons are visible on Win XP in the corner of the application window and alt-tab bar with both the test code you suggested and my applications.

They are not visible in the same way (or at all) on Lubuntu or Ubuntu (two different machines).

The test code:
Changed the class name to Main, created an ‘icons’ directory under Interface and added my own icons.

I’ll look into Lubuntu and Ubuntu (shell) launcher options to see if that’s the reason icons are not showing up there.

Thanks again

To recap, JMonkey applications, running on Linux do not show their icon in the corner of the window or the alt-tab bar. They are displayed on Windows XP.

I created a basic JFrame application and used the same icons to test whether it was Linux or the linux window manager that was at falt but the icon does display in both the alt-tab bar and in the corner of the JFrame window.

JMonkey and JFrame icons screen shot

This page also has the code I used to create a basic JFrame window.

It seems neither LWJGL2 nor LWJGL3 support setting the application’s icon on Linux. Maybe it is based on the icon set in the .desktop file (shortcut)

If you are referring to .desktop launchers, I tried that but it made no difference. The launcher has the correct icon and the application starts but the icons are still missing from the window and alt-tab bar.

It seems it inherits the launcher’s icon for any AWT / Swing windows but not for the LWJGL window. So it does not seem to be possible as stated.

Thanks for investigating this problem.

I’m sorry to revive an old thread, but I seem to be having the same problem on Windows 7. It runs, but the icons are not displayed. Instead it shows the default windows 7 icon, such as this.

Has anyone got this working on Windows 7?

So sorry, my bad. The resolutions weren’t exactly set to the corresponding values.