CodenameOne GUI Builder Button Image Problem

40 Views Asked by At

The CodenameOne GUI Builder seems to have a mind of its own..

I created a simple form with a button that has a green image when it is enabled and red when disabled. In my code I use another button to call an event function that enables and disables the button.

This seems pretty simple, yet it doesn't work reliably. The button's image changes between green and transparent as it toggles. Other times it works correctly. After I make a change I always do a 'save' and a 'regen' in the GUI Builder and then 'Clean and Build' in NetBeans.

Also, the size of my image is much smaller in the simulator than in the GUI Builder.

GUI Builder is sooo frustrating; I wish I could just code the for using html and css :(

Any suggestions would be appreciated.

Please see my video capture (https://siscocircuits.com/cno_gui_builder_problem.wmv) which shows the problem in action.

1

There are 1 best solutions below

2
On

You can write code in Java to represent the GUI. In fact that's what the GUI builder does under the surface and that's what most of our demos do. We also support a form of CSS.

The problem with the image sizes is probably due to the fact that you used regular images instead of multi-images to adapt to the various DPIs. I suggest reviewing the generated code to see what went wrong it's a bit difficult to see in the video but you can put a breakpoint in the debugger and step over the generated code.