hi bladestorm,
if we are talking about S60 2nd Ed FP2 (or generally all S60 before 3rd Ed) that you can do following for games (canvas/game canvas/nokia full screen canvas):
Code:
package tests;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TestMidlet extends MIDlet implements CommandListener {
public void startApp() {
Displayable current = Display.getDisplay(this).getCurrent();
if(current == null){
current = (Displayable)new MyCanvas(this);
((MyCanvas)current).setFullScreenMode(true);
}
Display.getDisplay(this).setCurrent(current);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable displayable) {
if(command.getCommandType() == Command.EXIT){
Display.getDisplay(this).setCurrent(null);
notifyDestroyed();
}
}
//
class MyCanvas extends Canvas {
private TestMidlet parent;
public MyCanvas(final TestMidlet parent){
this.parent = parent;
}
protected void paint(Graphics g) {
g.setColor(0xFFFFFF);
g.fillRect(0,0,getWidth(), getHeight());
String quitLabel = "Quit";
Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
int labelWidth = font.stringWidth(quitLabel);
int labelHeight = font.getHeight();
g.setColor(0x00);
g.drawString("Quit", getWidth()- labelWidth, getHeight()-labelHeight, Graphics.LEFT | Graphics.TOP);
}
protected void keyPressed(int keyCode){
switch(keyCode){
//
// RIGHT SOFT KEY
//
case -7:
parent.commandAction(new Command("Quit", Command.EXIT, 1), this);
break;
default:
// nothing //
}
}
}
}
that is:
- put screen into full screen mode
- add manually drawn "Quit" label
- on RightSoftKey pressed do quit
hth,
regards,
Peter