Hello, i am having trouble calling the displayable-funcion
in my MIDlet class from a separate class.
I want to trigger either testForm1 or testForm2 (whichever is most easy)
and put it as the current displayable in my MIDlet when pressing LEFT
without using canvas as a subclass in my SchemaMidlet.
How ?
This is a oversimplification of my programs structure:
class mainCanvas extends Canvas {
Form testForm1;
....
public mainCanvas {
testForm1 = new Form("Hello1");
....
public void paint(Graphics g) {
....
}
protected void keyPressed(int keyCode) {
if (getGameAction(keyCode) == Canvas.LEFT) {
***HERE I WANT TO CHANGE THE CURRENT DISPLAYABLE***
this.repaint();
}
}
}
public class SchemaMidlet extends MIDlet implements CommandListener {
private mainCanvas schemaCanvas;
public Display display;
Form testForm2;
public SchemaMidlet() {
schemaCanvas = new mainCanvas();
testForm2 = new Form("Hello2");
}
protected void startApp() {
display = Display.getDisplay(this);
schemaCanvas.setCommandListener(this);
display.setCurrent(schemaCanvas);
schemaCanvas.repaint();
}
public void commandAction(Command c, Displayable s) {
...
}
protected void destroyApp(boolean unconditional) {
}
protected void pauseApp() {
}
}