An Helper class for basic styling in Codename One, which provides an alternative to having endless UDIDs
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
nbproject
src/com/diamonddevgroup/utils
.gitignore
Helper.cn1lib
LICENSE.txt
README.md
Stubber.jar First commit Dec 14, 2016
build.xml
codenameone_library_appended.properties
codenameone_library_required.properties
manifest.mf
manifest.properties Added methods for setting a different pressed state foreground and ba… Feb 4, 2017

README.md

cn1-Helper

A Helper library for basic styling using code in Codename One. This eliminates the need to have endless UIID in your GUI builder

Download Helper.cn1Lib to the Lib folder of your project. Go to your project and do Refresh cn1Lib files. Call new Helper(myCmp) only AFTER setUIID() method and not BEFORE.

JavaDoc

View the project JavaDoc here.

Usage example

Basic styling of a single component

 Label myLabel = new Label("Test Label");
 new Helper(myLabel).pa1().ma0().textGreen().bgColor(0xe1e1e1);

Style a single component with custom Unit

Label myLabel = new Label("Test Label");
new Helper(myLabel, , Style.UNIT_TYPE_PIXELS).pa1().ma0().textGreen().bgColor(0xe1e1e1);

Apply same style to multiple unrelated components, individual styles could still be applied

Button myButton = new Button("Test Button 1");
Label myLabel = new Label("Test Label");
SpanLabel mySpanLabel = new SpanLabel("Test SpanLabel");
new Helper(myButton, myLabel, mySpanLabel.getComponentAt(1)).pa1().ma0().textGreen().bgColor(0xe1e1e1);

Contribution

You are welcome to add more styling. Fork the project and commit your code. You can also improve the documentation, methods and classes used.