Form f = new Form(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
Button btn = new Button("Click me");
Label lbl = new Label("Replace this");
Label lbl2 = new Label("Label replaced");
Container cont = new Container(new BoxLayout(BoxLayout.Y_AXIS));
cont.addAll(lbl, btn);
f.add(BorderLayout.CENTER, cont);
f.getToolbar().addComponentToSideMenu(new Label("Side Menu"));
f.show();
btn.addActionListener((evt) -> {
if (cont.contains(lbl))
cont.replace(lbl, lbl2, CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 300));
else
cont.replace(lbl2, lbl, CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, true, 300));
});