Icon property of Label or Button selected for a pic, pic does not appear when running app

53 views
Skip to first unread message

Clement Levallois

unread,
Oct 13, 2016, 5:01:08 AM10/13/16
to CodenameOne Discussions
To reproduce:

- create a Hello World bare bones project with plugin 3.5.5 on NetBeans
- create a Form through File -> New -> GUI Component Form
- launch the GUI Builder for this Form, add a Label to it through the GUI Builder
- import these pics through the old gui builder (see pics in attachement)
- in the new GUI Builder, change the icon property of the Label and select one of the pics (jpg or png).
- save the Form
- run the app: the pic is not displayed.

help?


If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device
test.jpg
test.png

Chen Fishbein

unread,
Oct 13, 2016, 2:16:19 PM10/13/16
to CodenameOne Discussions
just tried with your image and it worked.
Do you have a similar line of code generated in your GuiComponent.java?

gui_Label_4.setIcon(resourceObjectInstance.getImage("test.jpg"));


Clement Levallois

unread,
Oct 13, 2016, 3:09:07 PM10/13/16
to CodenameOne Discussions
Oui j'ai bien:

// <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initGuiBuilderComponents(com.codename1.ui.util.Resources resourceObjectInstance) {
        setLayout(new com.codename1.ui.layouts.FlowLayout());
        setTitle("Screen1");
        setName("Screen1");
        addComponent(gui_Label_1);
        gui_Label_1.setText("Label");
        gui_Label_1.setName("Label_1");
        gui_Label_1.setIcon(resourceObjectInstance.getImage("test.png"));
    }// </editor-fold>

Chen Fishbein

unread,
Oct 14, 2016, 4:47:41 AM10/14/16
to CodenameOne Discussions
and the res file is saved and you have this image in the images?

Clement Levallois

unread,
Oct 16, 2016, 4:39:11 PM10/16/16
to CodenameOne Discussions
Yes. A real mistery.

Shai Almog

unread,
Oct 16, 2016, 9:25:39 PM10/16/16
to CodenameOne Discussions
Does it work after restarting the GUI builder?

Clement Levallois

unread,
Oct 19, 2016, 2:48:13 PM10/19/16
to CodenameOne Discussions
No. Here is a link to the zip of the project: https://dl.dropboxusercontent.com/u/28091845/testjpg.zip 

Clement Levallois

unread,
Oct 19, 2016, 4:21:59 PM10/19/16
to CodenameOne Discussions
Sorry, this was a moronic error on my side. The wrong screen was shown. I owe you a beer for the wasted time.
Reply all
Reply to author
Forward
0 new messages