| ID | KIJ001373 | Creation date | June 12, 2009 |
| Platform | S60 5th Edition | Devices | Nokia 5800 XpressMusic |
| Category | Java ME | Subcategory | UI |
| Keywords (APIs, classes, methods, functions): Canvas.repaint(), Display.setCurrent(Displayable) |
The status pane area is not updated correctly when full-screen Canvas is in the background with two or more pop-up-type components on top of it and another Displayable object is set as current.
1. Implement a test MIDlet using the following example. Include the related JAD attribute/value pair in the JAD file: Nokia-UI-Enhancement: PopUpTextBox in the TextBox object to make it a Pop-Up TextBox.
Code for main MIDlet:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class CanvasUpdate extends MIDlet implements CommandListener{
Display d;
Form f;
Alert a;
TestCanvas tc;
TextField tf;
Command canvasCmd;
Command alertCmd;
Command formCmd;
Command textBoxCmd;
TextBox tb;
public CanvasUpdate(){
d=Display.getDisplay(this);
f=new Form("Test Form");
a=new Alert("Test Alert");
tb=new TextBox("Test TextBox", "", 25, TextField.ANY);
canvasCmd=new Command("Canvas",Command.SCREEN,1);
alertCmd=new Command("Alert",Command.SCREEN,1);
formCmd=new Command("Form",Command.SCREEN,1);
textBoxCmd=new Command("TextBox",Command.SCREEN,1);
f.addCommand(alertCmd);
f.addCommand(canvasCmd);
f.addCommand(textBoxCmd);
f.setCommandListener(this);
a.addCommand(canvasCmd);
a.addCommand(formCmd);
a.addCommand(textBoxCmd);
a.setCommandListener(this);
tb.addCommand(alertCmd);
tb.addCommand(canvasCmd);
tb.addCommand(formCmd);
tb.setCommandListener(this);
tc=new TestCanvas(this);
}
public void startApp() {
d.setCurrent(tc);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command cmd, Displayable dp) {
if(cmd==canvasCmd){
d.setCurrent(tc);
}
if(cmd==alertCmd){
d.setCurrent(a);
}
if(cmd==formCmd){
d.setCurrent(f);
}
if(cmd==textBoxCmd){
d.setCurrent(tb);
}
}
}
Code for TestCanvas:
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
public class TestCanvas extends Canvas implements CommandListener{
CanvasUpdate cu;
Command cmdAlert;
Command cmdForm;
Command cmdPopUpTextBox;
public TestCanvas(CanvasUpdate cu) {
this.cu=cu;
cmdAlert = new Command ("Alert", Command.SCREEN, 0);
cmdForm = new Command ("Form", Command.SCREEN, 0);
cmdPopUpTextBox = new Command("TextBox",Command.SCREEN,0);
this.addCommand(cmdAlert);
this.addCommand(cmdForm);
this.addCommand(cmdPopUpTextBox);
this.setCommandListener(this);
this.setFullScreenMode(true);
}
protected void paint(Graphics g) {
g.setColor(16000);
g.fillRect(0, 0, getWidth(), getHeight());
}
public void commandAction(Command c, Displayable d) {
if(c==cmdForm){
cu.d.setCurrent(cu.f);
}
if(c==cmdAlert){
cu.d.setCurrent(cu.a);
}
if(c==cmdPopUpTextBox){
cu.d.setCurrent(cu.tb);
}
}
}
2. After launching the MIDlet with the Canvas on the screen, press the LSK or the RSK to view the list including Alert, Form, and TextBox.
3. Set an Alert on the screen.
4. Set a Pop-Up TextBox on the screen.
5. Set a Form on the screen. For the affected devices, a rectangle area of Canvas appears on top of the screen in the status pane area instead of the entire Form covering the screen area.
This issue is expected to be fixed in future S60 5th Edition devices.
No related wiki articles found