-
Notifications
You must be signed in to change notification settings - Fork 409
Working With The GUI Builder
The basic premise is this: the designer creates a UI version and names GUI components, he can create commands as well including navigation commands, exit, minimize. He can also define a long running command, which will by default trigger a thread to execute…
All UI elements can be loaded using the UIBuilder
class. Why not just use the Resources API?
Since the Resources
class is essential for using Codename One, adding the UIBuilder
as an import would cause any application (even those that don’t use the UIBuilder) to increase in size! We don’t want people who aren’t using the feature to pay the penalty for its existence!
The UI Builder is designed for use as a state machine carrying out the current state of the application so when any event occurs a subclass of the UIBuilder can just process it. The simplest way and most robust way for changes is to use the Codename One Designer to generate some code for you (yes we know its not a code generation tool but there is a hack…).
When using a GUI builder project it will constantly regenerate the state machine base class which is a UIBuilder subclass containing most of what you need…
Warning
|
The trick is not to touch that code! DO NOT CHANGE THAT CODE! |
Sure you can change it and everything will be just fine, however it you will make changes to the GUI regenerating that file will obviously lose all those changes which is not something you want!
To solve it you need to write your code within the State machine class which is a subclass of the state machine base class and just override the appropriate methods, then when the UI changes the GUI builder just safely overwrites the base class since you didn’t change anything there…
About This Guide
Introduction
Basics: Themes, Styles, Components & Layouts
Theme Basics
Advanced Theming
Working With The GUI Builder
The Components Of Codename One
Using ComponentSelector
Animations & Transitions
The EDT - Event Dispatch Thread
Monetization
Graphics, Drawing, Images & Fonts
Events
File-System,-Storage,-Network-&-Parsing
Miscellaneous Features
Performance, Size & Debugging
Advanced Topics/Under The Hood
Signing, Certificates & Provisioning
Appendix: Working With iOS
Appendix: Working with Mac OS X
Appendix: Working With Javascript
Appendix: Working With UWP
Security
cn1libs
Appendix: Casual Game Programming