You can also specify the form as a parameter
chooseDB(c.getComponentForm());
private void chooseDB(final Form main) {
Form f = new Form("Choose a Database");
...
Command backCommand = new Command("Back") {
public void actionPerformed(ActionEvent ev) {
main.showBack();
}};
f.addCommand(backCommand);
f.setBackCommand(backCommand);
f.show();
}
So for your example:
Button b = new Button("Clickme");
b.setActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Form f = new Form();
Container c = new Container();
Command backCommand = new Command("Settings") {
public void actionPerformed(ActionEvent ev) {
b.getComponentForm().showBack();
}};
f.addCommand(backCommand);
f.setBackCommand(backCommand);
f.addComponent(c);
f.show();
}
});
, , , - . .