I want to add two
buttons on side menu . One
at top and other
at bottom so I have added below code
but its not working and its displayed image is added .
how to add buttons on sidemenu
on top
and bottom
?
Toolbar addToolbar(Form f) {
Toolbar toolbar = new Toolbar();
f.setToolbar(toolbar);
Container container = new Container(new BorderLayout());
container.add(BorderLayout.NORTH,new Button(" north"));
container.add(BorderLayout.SOUTH,new Button(" south"));
toolbar.addComponentToSideMenu(container);
}
void addToolbars(Form fs) {
Form f = new Form(" Test");
Toolbar toolbar = new Toolbar();
f.setToolbar(toolbar);
Container container = new Container(new BorderLayout());
container.add(BorderLayout.NORTH, new Button(" north"));
container.add(BorderLayout.CENTER, new Button("center"));
container.add(BorderLayout.SOUTH, new Button(" south"));
toolbar.addComponentToSideMenu(container);
Container mySideMenuContainer = new Container() {
@Override
public void initComponent() {
getParent().setLayout(new GridLayout(1, 1));
getParent().setScrollableY(false);
getParent().revalidate();
}
};
mySideMenuContainer.addComponent(container);
toolbar.addComponentToSideMenu(mySideMenuContainer);
f.show();
}
the container contains only half of screen as shown in image
There is no API for that and it's not supported.
However, like anything in Codename One you can sometimes hack things together.
E.g. something like this should work as a hack although I can't guarantee it will work forever as it relies on implementation details of the
addComponentToSideMenu
method: