简体   繁体   English

CodenameOne GUI Builder 按钮图像问题

[英]CodenameOne GUI Builder Button Image Problem

The CodenameOne GUI Builder seems to have a mind of its own.. CodenameOne GUI Builder 似乎有自己的想法……

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.进行更改后,我总是在 GUI Builder 中执行“保存”和“重新生成”,然后在 NetBeans 中执行“清理和构建”。

Also, the size of my image is much smaller in the simulator than in the GUI Builder.此外,我的图像在模拟器中的大小比在 GUI Builder 中小得多。

GUI Builder is sooo frustrating; GUI Builder 太令人沮丧了; I wish I could just code the for using html and css:(我希望我可以使用 html 和 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.请查看我的视频捕获 ( https://siscocircuits.com/cno_gui_builder_problem.wmv ),其中显示了实际问题。

You can write code in Java to represent the GUI.您可以用 Java 编写代码来表示 GUI。 In fact that's what the GUI builder does under the surface and that's what most of our demos do.事实上,这就是 GUI 构建器在表面下所做的事情,也是我们大多数演示所做的事情。 We also support a form of CSS.我们还支持一种 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.图像大小的问题可能是由于您使用常规图像而不是多图像来适应各种 DPI。 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.我建议查看生成的代码,看看哪里出了问题,在视频中很难看出来,但您可以在调试器中放置一个断点,然后跨过生成的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM