<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://startofentry.blogdns.org/rdf'>
    <s:Snip rdf:ID='FullscreenCanvasExample'
         s:name='FullscreenCanvasExample'
         s:cUser='ivonne'
         s:oUser='ivonne'
         s:mUser='case'>
        <s:content>__~~ INFORMATION IS OUTDATED (needs reworked for correct build and link proecdures - Canvas/Displayable method move MIDP1 - MIDP2)~~__&#xD;&#xA;&#xD;&#xA;1 Midlets using Fullscreen&#xD;&#xA;&#xD;&#xA;When creating games for mobile devices we always had the problem that we need to use the fullscreen display to get the maximum resolution.&#xD;&#xA;&#xD;&#xA;There are 2 ways to display a midlet in fullscreen mode:&#xD;&#xA;- Nokia FullCanvas &#xD;&#xA;- MIDP 2.0 Fullscreen&#xD;&#xA;&#xD;&#xA;But we want only one single JAR file which can run on all devices.&#xD;&#xA;The following chapters will explain how this can be done.&#xD;&#xA;&#xD;&#xA;Test the example midlet:&#xD;&#xA;* {link:CanvasTest.jad|space/FullscreenCanvasExample/CanvasTest.jad|none}&#xD;&#xA;* {link:CanvasTest.jar|space/FullscreenCanvasExample/CanvasTest.jar|none}&#xD;&#xA;&#xD;&#xA;The complete source code of the example:&#xD;&#xA;* {link:CanvasTest_src.zip|space/FullscreenCanvasExample/CanvasTest_src.zip|none}&#xD;&#xA;&#xD;&#xA;1.1 Nokia FullCanvas&#xD;&#xA;&#xD;&#xA;For Nokia devices there is a special super class to use fullscreen even on MIPD 1.0 devices. Your canvas implementation needs to extend com.nokia.mid.ui.FullCanvas.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;import com.nokia.mid.ui.FullCanvas;&#xD;&#xA;public class MyCanvas extends FullCanvas {&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 MIDP 2.0 Fullscreen&#xD;&#xA;&#xD;&#xA;Since MIDP 2.0 the Canvas class supports setFullScreenMode() to switch between fullscreen mode and normal display.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;import javax.microedition.lcdui.Canvas;&#xD;&#xA;public class MyCanvas extends Canvas {&#xD;&#xA;&#9;public MyCanvas() {&#xD;&#xA;&#9;&#9;super();&#xD;&#xA;&#9;&#9;setFullScreenMode(true);&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1.1 Device specific implementation&#xD;&#xA;&#xD;&#xA;To support fullscreen on each device you need to support 3 types of devices&#xD;&#xA;- MIDP 2.0 devices&#xD;&#xA;- MIDP 1.0 Nokia devices&#xD;&#xA;- MIDP 1.0 non-Nokia devices (= no fullscreen supported)&#xD;&#xA;&#xD;&#xA;You need to build different JARs for each of these device type, because for example you can&apos;t call the setFullScreenMode() in MIDP 1.0 compiled code.&#xD;&#xA;&#xD;&#xA;You can use a precompiler like {link:Anteanna|http://antenna.sourceforge.net} to &#xD;&#xA;change the super class of MyCanvas depended if Nokia device or not. For the constructor you can use another precompiler tag to check if MIDP 2.0 is supported and if you can call setFullScreenMode().&#xD;&#xA;Check out [eclipseME and Antenna].&#xD;&#xA;&#xD;&#xA;This results in 3 different JARs. But the purpose of this example is to build only one JAR which runs on all 3 device types.&#xD;&#xA;&#xD;&#xA;1.1 Check for Nokia device&#xD;&#xA;&#xD;&#xA;To check if the device is a Nokia device you can use reflection.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public static boolean isNokiaDevice() {&#xD;&#xA;&#9;try {&#xD;&#xA;&#9;&#9;Class.forName(&quot;com.nokia.mid.ui.DeviceControl&quot;);&#xD;&#xA;&#9;&#9;return true;&#xD;&#xA;&#9;} catch (final Exception ex) {&#xD;&#xA;&#9;}&#xD;&#xA;&#9;return false;&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 Check for MIDP 2.0&#xD;&#xA;&#xD;&#xA;To check if the device supports MIDP 2.0 you can check the system properties.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public static boolean isMidp20Supported() {&#xD;&#xA;&#9;final String profiles = System.getProperty(&quot;microedition.profiles&quot;);&#xD;&#xA;&#9;if (profiles.startsWith(&quot;MIDP-2.&quot;)) {&#xD;&#xA;&#9;&#9;return true;&#xD;&#xA;&#9;}&#xD;&#xA;&#9;return false;&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1.1 JAR with mixed classes&#xD;&#xA;&#xD;&#xA;Dynamic check can be used to decide which feature is supported by the device. But we need to build a [Midlet] with all these features in one JAR. This is possible by using a JAR with mixed classes:&#xD;&#xA;&#xD;&#xA;- all application classes compiled with MIDP 1.0&#xD;&#xA;- a canvas implementation using Nokia-FullCanvas&#xD;&#xA;- a canvas implemantation compiled with MIDP 2.0 to use setFullScreenMode()&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1.1 Include Nokia specific features&#xD;&#xA;&#xD;&#xA;The JAR file could contain a class which will only run on Nokia devices like MyNokiaCanvas. This class can use Nokia specific classes like com.nokia.mid.ui.DeviceControl to control the backlight level of the display.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;import com.nokia.mid.ui.FullCanvas;&#xD;&#xA;import com.nokia.mid.ui.DeviceControl;&#xD;&#xA;public class MyNokiaCanvas extends FullCanvas {&#xD;&#xA;&#xD;&#xA;&#9;public static void setBacklight(final int level) {&#xD;&#xA;&#9;&#9;if (level &gt;= 0 &amp;&amp; level &lt;= 100)&#xD;&#xA;&#9;&#9;&#9;DeviceControl.setLights(0, level);&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;The application itself should use this Nokia specific feature only if the device  is a Nokia device.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;import javax.microedition.lcdui.Canvas;&#xD;&#xA;public class MyCanvas extends Canvas {&#xD;&#xA;&#xD;&#xA;&#9;public static void setBacklight(final int level) {&#xD;&#xA;&#9;&#9;if (isNokiaDevice()) {&#xD;&#xA;&#9;&#9;&#9;MyNokiaCanvas.setBacklight(level);&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;The Java virtual machine will not access the MyNokiaCanvas class on none-Nokia device. So this code will run on both types of devices: Nokia or other vendor.&#xD;&#xA;&#xD;&#xA;1.1 Include MIDP 2.0 features&#xD;&#xA;&#xD;&#xA;Its possible to mix MIDP 1.0 and MIDP 2.0 classes within one JAR as long as the MIDP 2.0 class is only called by reflection if the device supports MIDP 2.0.&#xD;&#xA;&#xD;&#xA;The JAD file needs to declare the midlet as MIDP 1.0.&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;MicroEdition-Configuration: CLDC-1.0&#xD;&#xA;MicroEdition-Profile: MIDP-1.0&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;The JAR file could contain a class like My20Canvas which calls new MIDP 2.0 features like setFullScreenMode.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class My20Canvas extends MyCanvas {&#xD;&#xA;&#xD;&#xA;&#9;public void setFullScreenRequested(final boolean useFullScreen) {&#xD;&#xA;&#9;&#9;setFullScreenMode(useFullScreen);&#xD;&#xA;&#9;&#9;super.setFullScreenRequested(useFullScreen);&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;The normal canvas implemantation (MyCanvas) will ignore the request for fullscreen mode.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;import javax.microedition.lcdui.Canvas;&#xD;&#xA;public class MyCanvas extends Canvas {&#xD;&#xA;&#xD;&#xA;&#9;public void setFullScreenRequested(final boolean useFullScreen) {&#xD;&#xA;&#9;&#9;// no full screen supported in MIDP 1.0&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;(see also http://today.java.net/pub/a/today/2005/02/09/j2me1.html?page=2 for Step 7: Deploy for some infos on handling MIDP 1.0/2.0)&#xD;&#xA;&#xD;&#xA;To include My20Canvas &#xD;&#xA;- Keep jad setting to MIDP 1.0 and CLDC 1.0&#xD;&#xA;- build the JAR with MIDP 2.0 and CLDC 1.0 (this might be a problem with eclipseME, but can be achieved with WTK). I have not researched, if preverification with CLDC 1.1 is compatible on CLDC 1.0 devices.&#xD;&#xA;- make sure, that manifest now holds the jad entries (MIDP1.0 and CLDC1.0)&#xD;&#xA;&#xD;&#xA;Now the JAR will run on MIPD 1.0 and MIDP 2.0 devices.&#xD;&#xA;&#xD;&#xA;There have been some issues using the antenna build files created with eclipseME. Mainly these were:&#xD;&#xA;* eclipseme-build.xml encoding was set to UTF-8, which might be a problem, if the sources are created with another Codepage&#xD;&#xA;* eclipseme-build.xml, wtkobfuscate task had incorrect path to additional libs (e.g. nokiaapi.jar)&#xD;&#xA;* eclipseme-build.xml wtkpreverify could also not see aditional jars and therefore a classpath refid was included&#xD;&#xA;* (if you want to have preprocessing, you will need to include the wtkpreprocess task into the build file and make build task depend on it. Details can be found in [eclipseME and Antenna])&#xD;&#xA;&#xD;&#xA;1.1 3 Canvas implementations: MyCanvas, My20Canvas, MyNokiaCanvas&#xD;&#xA;&#xD;&#xA;To use specific Canvas feature we use 3 different Canvas implementations:&#xD;&#xA;&#xD;&#xA;- MyCanvas extends Canvas &#xD;&#xA;- My20Canvas extends MyCanvas&#xD;&#xA;- MyNokiaCanvas extends FullCanvas&#xD;&#xA;&#xD;&#xA;During startup of the midlet we decide which class should be used:&#xD;&#xA;- if MIDP 2.0 supported =&gt; use My20Canvas&#xD;&#xA;- if MIDP 1.0 and Nokia device =&gt; use MyNokiaCanvas&#xD;&#xA;- if MIDP 1.0 and no Nokia device =&gt; use MyCanvas&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;&#9;public static Canvas getCanvas(final boolean useFullScreen) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;ICanvas theCanvas = null;&#xD;&#xA;&#xD;&#xA;&#9;&#9;final boolean midp20 = isMidp20Supported();&#xD;&#xA;&#9;&#9;if (midp20) {&#xD;&#xA;&#9;&#9;&#9;try {&#xD;&#xA;&#9;&#9;&#9;&#9;theCanvas = (ICanvas) (Class&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;&#9;.forName(&quot;de.wintermute.midlet.My20Canvas&quot;))&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;&#9;.newInstance();&#xD;&#xA;&#9;&#9;&#9;} catch (Exception e) {&#xD;&#xA;&#9;&#9;&#9;}&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;&#9;if (theCanvas == null &amp;&amp; useFullScreen) {&#xD;&#xA;&#9;&#9;&#9;try {&#xD;&#xA;&#9;&#9;&#9;&#9;Class.forName(&quot;com.nokia.mid.ui.FullCanvas&quot;);&#xD;&#xA;&#9;&#9;&#9;&#9;theCanvas = (ICanvas) (Class&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;&#9;.forName(&quot;de.wintermute.midlet.MyNokiaCanvas&quot;))&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;&#9;.newInstance();&#xD;&#xA;&#9;&#9;&#9;} catch (Exception e2) {&#xD;&#xA;&#9;&#9;&#9;}&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;&#9;if (theCanvas == null) {&#xD;&#xA;&#9;&#9;&#9;theCanvas = new MyCanvas();&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;&#9;theCanvas.setFullScreenRequested(useFullScreen);&#xD;&#xA;&#9;&#9;return (Canvas) theCanvas;&#xD;&#xA;&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 Delegation pattern to use Canvas implementation&#xD;&#xA;&#xD;&#xA;To use one of the 3 specific Canvas implementations you can not just extend these classes. Therefor we use a delegation pattern. A new super class MyGui was used:&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public abstract class MyGui implements IGui {&#xD;&#xA;&#xD;&#xA;&#9;private Canvas theCanvas;&#xD;&#xA;&#xD;&#xA;&#9;public final int getWidth() {&#xD;&#xA;&#xD;&#xA;&#9;&#9;return theCanvas.getWidth();&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Every method call which are usally implemented in Canvas super class (like getWidth) is now delegated to the canvas implementation itself.&#xD;&#xA;&#xD;&#xA;In the other direction the canvas implementation needs to delegate events like keyPressed to the application.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class MyCanvas extends Canvas implements ICanvas {&#xD;&#xA;&#xD;&#xA;&#9;protected IGui gui;&#xD;&#xA;&#xD;&#xA;&#9;protected void keyPressed(final int k) {&#xD;&#xA;&#9;&#9;gui.keyPressed(k);&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 Initialize the application GUI and Canvas&#xD;&#xA;&#xD;&#xA;If you implement a graphical midlet, your usally have one class which extends Canvas.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class TestGui extends Canvas {&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Now you need to use MyGui as a super class.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class TestGui extends MyGui {&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Here you need to implement the same methods like extending Canvas directly. For example&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public void paint(final Graphics g)&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;There is only one new method to implement.&#xD;&#xA;&#xD;&#xA;To connect your GUI implementation with the specific Canvas class to use, you need to implement this init() method.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public interface IGui {&#xD;&#xA;&#9;public void init(final Canvas canvas, final MIDlet theMidlet);&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Usally you should implement this like in the example:&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public synchronized void init(final Canvas canvas, final MIDlet theMidlet) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;midlet = (CanvasTest) theMidlet;&#xD;&#xA;&#9;&#9;setCanvas(canvas);&#xD;&#xA;&#xD;&#xA;&#9;&#9;// do the painting or other application tasks here&#xD;&#xA;&#9;&#9;updateCanvas();&#xD;&#xA;&#9;&#9;repaint();&#xD;&#xA;&#9;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 Starting the midlet&#xD;&#xA;&#xD;&#xA;To start the midlet with the specific Canvas you need first to create a new instance of your application GUI and than initialize this GUI with the Canvas.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class CanvasTest extends MIDlet {&#xD;&#xA;&#xD;&#xA;&#9;private Canvas canvas = new MyCanvas();&#xD;&#xA;&#9;private TestGui gui;&#xD;&#xA;&#xD;&#xA;&#9;public CanvasTest() {&#xD;&#xA;&#9;&#9;// create the new GUI class&#xD;&#xA;&#9;&#9;gui = new TestGui();&#xD;&#xA;&#9;&#9;// create the Canvas and start the GUI&#xD;&#xA;&#9;&#9;createNewCanvas(true);&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;public void createNewCanvas(final boolean fullScreenRequested) {&#xD;&#xA;&#9;&#9;// get a new canvas implementation&#xD;&#xA;&#9;&#9;canvas = MyCanvas.getCanvas(fullScreenRequested);&#xD;&#xA;&#9;&#9;// initialize the GUI implemenation&#xD;&#xA;&#9;&#9;((ICanvas) canvas).init(this, gui);&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 Toggle normal / fullscreen mode&#xD;&#xA;&#xD;&#xA;Canvas objects are in normal mode by default. The normal vs. full-screen mode setting is controlled now by calling midlet.createNewCanvas() again.&#xD;&#xA;This will initialze the GUI implemenatation with the new Canvas by calling init(). &#xD;&#xA;&#xD;&#xA;Because the resolution will be different in fullscreen mode, you need to recalculate a size-depended values again, every time init() is called. If you working with a offscreen image for example to need to create a new image with the new size.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;offScreenImage = Image.createImage(getWidth(), getHeight());&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Calling setFullScreenMode(boolean) may result in sizeChanged() being called. Directly call of getWidth() might result in a wrong value. For this devices the My20Canvas needs to implement the callback method sizeChanged().&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class My20Canvas extends MyCanvas {&#xD;&#xA;&#xD;&#xA;&#9;public void sizeChanged(final int newWidth, final int newHeight) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;// some devices use this callback to tell the new size&#xD;&#xA;&#9;&#9;// re-initialize the GUI class to use new width or height&#xD;&#xA;&#9;&#9;init(midlet, gui);&#xD;&#xA;&#9;}&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1.1 Commands in Nokia FullCanvas&#xD;&#xA;&#xD;&#xA;If the device is a Nokia device and it only supports MIDP 1.0, we use the MyNokiaCanvas implementation.&#xD;&#xA;&#xD;&#xA;The problem is that Nokia-FullCanvas does not support CommandListener. If you call addCommand() or setCommandListener() this will result in a IllegalStateException.&#xD;&#xA;&#xD;&#xA;To use the same command handling for all 3 types of devices we need to create your own command handling for MyNokiaCanvas. We store the commands in a list and display this list as a Form when a specific game key is pressed.&#xD;&#xA;&#xD;&#xA;{code:java}&#xD;&#xA;public class MyNokiaCanvas extends FullCanvas implements ICanvas {&#xD;&#xA;&#xD;&#xA;&#9;private Vector commands = new Vector();&#xD;&#xA;&#9;private CommandListener listener;&#xD;&#xA;&#xD;&#xA;&#9;public void setCommandListener(final CommandListener controller) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;try {&#xD;&#xA;&#9;&#9;&#9;super.setCommandListener(controller);&#xD;&#xA;&#9;&#9;} catch (IllegalStateException e) {&#xD;&#xA;&#9;&#9;&#9;// Nokia FullScreenCanvas does not support setCommandListener()&#xD;&#xA;&#9;&#9;&#9;// store our own listener&#xD;&#xA;&#9;&#9;&#9;listener = controller;&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;public void addCommand(final Command command) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;try {&#xD;&#xA;&#9;&#9;&#9;super.addCommand(command);&#xD;&#xA;&#9;&#9;} catch (IllegalStateException ex) {&#xD;&#xA;&#9;&#9;&#9;// Nokia FullScreenCanvas does not support addCommand()&#xD;&#xA;&#9;&#9;&#9;// store our own command&#xD;&#xA;&#xD;&#xA;&#9;&#9;&#9;int i;&#xD;&#xA;&#9;&#9;&#9;for (i = 0; i &lt; commands.size()&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;&amp;&amp; ((Command) commands.elementAt(i)).getPriority() &lt; command&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;&#9;&#9;.getPriority(); i++)&#xD;&#xA;&#9;&#9;&#9;&#9;;&#xD;&#xA;&#9;&#9;&#9;commands.insertElementAt(command, i);&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#9;private void displayMenu() {&#xD;&#xA;&#xD;&#xA;&#9;&#9;final List menuList = new List(&quot;Menu&quot;, List.IMPLICIT);&#xD;&#xA;&#9;&#9;menuList.addCommand(backCommand);&#xD;&#xA;&#xD;&#xA;&#9;&#9;final Enumeration cmds = commands.elements();&#xD;&#xA;&#9;&#9;while (cmds.hasMoreElements()) {&#xD;&#xA;&#9;&#9;&#9;final Command cmd = (Command) cmds.nextElement();&#xD;&#xA;&#9;&#9;&#9;menuList.append(cmd.getLabel(), null);&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;&#9;// establish commands&#xD;&#xA;&#9;&#9;menuList.setCommandListener(new CommandListener() {&#xD;&#xA;&#xD;&#xA;&#9;&#9;&#9;public void commandAction(final Command command,&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;final Displayable displayable) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;&#9;&#9;if (command == backCommand) {&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;displayCanvas();&#xD;&#xA;&#xD;&#xA;&#9;&#9;&#9;&#9;} else {&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;final short index = (short) menuList.getSelectedIndex();&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;displayCanvas();&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;final Command cmd = (Command) commands.elementAt(index);&#xD;&#xA;&#9;&#9;&#9;&#9;&#9;listener.commandAction(cmd, null);&#xD;&#xA;&#9;&#9;&#9;&#9;}&#xD;&#xA;&#9;&#9;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;&#9;});&#xD;&#xA;&#9;&#9;Display.getDisplay(midlet).setCurrent(menuList);&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;protected void keyPressed(int k) {&#xD;&#xA;&#xD;&#xA;&#9;&#9;// special handling for Nokia FullScreen:&#xD;&#xA;&#9;&#9;// use SOFTKEY 1 to display internal menu&#xD;&#xA;&#9;&#9;if (listener != null &amp;&amp; k == FullCanvas.KEY_SOFTKEY1) {&#xD;&#xA;&#9;&#9;&#9;displayMenu();&#xD;&#xA;&#9;&#9;&#9;return;&#xD;&#xA;&#9;&#9;}&#xD;&#xA;&#xD;&#xA;&#9;&#9;// default key handling in the GUI class&#xD;&#xA;&#9;&#9;gui.keyPressed(k);&#xD;&#xA;&#9;}&#xD;&#xA;&#xD;&#xA;}&#xD;&#xA;{code}</s:content>
        <s:mTime>2006-10-21 15:02:04.242</s:mTime>
        <s:cTime>2006-06-28 10:53:02.257</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='#Midlet'/>
                <rdf:li rdf:resource='#ivonne'/>
                <rdf:li rdf:resource='#midlet'/>
                <rdf:li rdf:resource='http://startofentry.blogdns.org/rdf#MicroEmulator for MacOS j2me development'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://startofentry.blogdns.org/rdf#5ud0ku'/>
                <rdf:li rdf:resource='#Hitori'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='#hitori'/>
                <rdf:li rdf:resource='http://startofentry.blogdns.org/rdf#eclipseME and Antenna'/>
                <rdf:li rdf:resource='#snipsnap-help'/>
                <rdf:li rdf:resource='#snipsnap-notfound'/>
                <rdf:li rdf:resource='#Ivonne'/>
                <rdf:li rdf:resource='http://startofentry.blogdns.org/rdf#older changes'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments>
            <rdf:Bag>
                <rdf:li>
                    <s:Attachment rdf:about='http://startofentry.blogdns.org/space/FullscreenCanvasExample/CanvasTest.jad'
                         s:fileName='CanvasTest.jad'
                         s:contentType='JAD'
                         s:size='276'>
                        <s:date>Wed Jun 28 15:20:02 CEST 2006</s:date>
                    </s:Attachment>
                </rdf:li>
                <rdf:li>
                    <s:Attachment rdf:about='http://startofentry.blogdns.org/space/FullscreenCanvasExample/CanvasTest.jar'
                         s:fileName='CanvasTest.jar'
                         s:contentType='JAR'
                         s:size='12391'>
                        <s:date>Wed Jun 28 15:20:23 CEST 2006</s:date>
                    </s:Attachment>
                </rdf:li>
                <rdf:li>
                    <s:Attachment rdf:about='http://startofentry.blogdns.org/space/FullscreenCanvasExample/CanvasTest_src.zip'
                         s:fileName='CanvasTest_src.zip'
                         s:contentType='application/x-zip-compressed'
                         s:size='14241'>
                        <s:date>Thu Jun 29 00:21:47 CEST 2006</s:date>
                    </s:Attachment>
                </rdf:li>
            </rdf:Bag>
        </s:attachments>
    </s:Snip>
</rdf:RDF>
