Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created January 27, 2016 21:02
Show Gist options
  • Save codenameone/cd69363cc953f6bdb66c to your computer and use it in GitHub Desktop.
Save codenameone/cd69363cc953f6bdb66c to your computer and use it in GitHub Desktop.
Sample of the grid layout from Codename One
Form hi = new Form("Grid Layout 2x2", new GridLayout(2, 2));
hi.add(new Label("First")).
add(new Label("Second")).
add(new Label("Third")).
add(new Label("Fourth")).
add(new Label("Fifth"));
@codenameone
Copy link
Author

Sample usage code for GridLayout

Demonstrates that even though the grid was created with 2x2 spaces, adding 5 elements will implicitly add another row and leave the last cell blank.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment