Custom icon list

hey guys,

I’m trying to create a file of auxiliary icons, I’m following the process explained here

https://docs.jmix.io/jmix/ui/icons/icon-sets.html

however I managed to list it in the icon window, but it does not display the image.

could someone show me where my mistake is?

class code

package br.com.pedromas.prp;

import io.jmix.ui.icon.Icons;

public enum Imagens implements Icons.Icon {

    DESABILITAR("classpath:br/com/pedromas/prp/imagens/desabilitar.png")    ;

    private String source;

    Imagens(String source) {
        this.source = source;
    }

    @Override
    public String source() {
        return source;
    }

    @Override
    public String iconName() {
        return name();
    }

    private String id;

}

icon selection screen
lista_icones

arquivos

Hi,

Could you please attach a demo project that reproduces the issue?

Regards,
Gleb

no problems, attached a clean project, and on the user list screen I added a test button.

presented in the same way.

thank you for the time

testeIcone.zip (83.2 KB)

Hi,

Thank you for the demo project, it helped a lot. The trick is that class path have to start with /. So in the demo project the following doesn’t work:

DESABILITAR("classpath:com/company/testeicone/imagens/desabilitar.png");

but this works:

DESABILITAR("classpath:/com/company/testeicone/imagens/desabilitar.png");

The doc examples also start with /, e.g.:

EYE("classpath:/icon/eye.png"), 
PENGUIN("classpath:/icon/penguin.png"); 
<button icon="classpath:/icon/eye.png"/>

Regards,
Gleb

1 Like

sorry for the mistake, an inexplicable failure.

But I’m going ahead, is there any way to present the image during development time, how does it present the others?

running it works normally, in the images below you can see both screens.

tela_exec
desenv_xml

Hi,

Unfortunately, Studio can only display built-in icons from Jmix, any custom iconset works at runtime, but screen designer can’t show them.

Regards,
Gleb

Got it, thanks for the support.

thank you very much