Skip to content

Instantly share code, notes, and snippets.

@narrowtux
Created December 16, 2011 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save narrowtux/1486905 to your computer and use it in GitHub Desktop.
Save narrowtux/1486905 to your computer and use it in GitHub Desktop.
Contianer c = new GenericContainer();
c.setLayout(new VerticalLayout());
c.setGeometry(5,5,width - 10, height - 10);
c.attachWidget(addon, new GenericLabel("Title")); //Same as c.getLayout().addItem(new WidgetItem(widget));
c.getLayout().addItem(new SpacerItem(0, 25, 0, Integer.INFINITY)); //minWidth, minHeight, maxWidth, maxHeight
Button b = new GenericButton("Done");
b.setMaxWidth(200);
c.attachWidget(addon, b);
c.getLayout().setAlign(WidgetAnchor.TOP_CENTER);
screen.attachWidget(addon, c);
/*
this would make a screen where the title would be top-center, the button bottom-center (because the spacer pushes them out of each other).
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment