Results 1 to 4 of 4
  1. #1
    just_in_deed is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default SkeletonMidlet is not abstract and does not override abstract method

    Hi all I need help solving this error:

    SkeletonMidlet is not abstract and does not override abstract method commandAction(javax.microedition.lcdui.Command,jav ax.microedition.lcdui.Displayable) in javax.microedition.lcdui.CommandListener
    public class SkeletonMidlet extends MIDlet implements CommandListener {
    and here is the code:

    __________________________________________________ ________________________

    // CLASS SkeletonMidlet

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class SkeletonMidlet extends MIDlet implements CommandListener {
    private SCanvas canvas;

    public void startApp() {
    if (canvas == null){
    canvas = new SCanvas( Display.getDisplay(this) );
    Command exitCommand = new Command("Exit", Command.EXIT, 0);
    canvas.addCommand(exitCommand);
    canvas.setCommandListener(this);
    }
    canvas.start();
    }

    public void pauseApp() {}

    public void destroyApp(boolean unconditional) {}

    public void CommandAction( Command c, Displayable s ){
    if( c.getCommandType() == Command.EXIT ){
    destroyApp( true );
    notifyDestroyed();
    }
    }
    }

    __________________________________________________ ________________________

    //CLASS SCanvas

    import javax.microedition.lcdui.*;

    public class SCanvas extends Canvas{
    public Display display;

    public SCanvas( Display d ){
    super();
    display = d;
    }

    void start(){
    display.setCurrent(this);
    repaint();
    }

    public void paint( Graphics g ){
    g.setColor( 0, 0, 0 );
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor( 255, 255, 255 );
    int y = 0;
    String screenSize = "Screen size" + Integer.toString(getWidth())
    + " x " + Integer.toString(getHeight());
    g.drawString(screenSize, 0, y, Graphics.TOP | Graphics.LEFT);

    y += Font.getDefaultFont().getHeight();
    String numColors = " # of colors : " + Integer.toString(display.numColors());
    g.drawString(numColors, 0, y, Graphics.TOP | Graphics.LEFT);

    y += Font.getDefaultFont().getHeight();
    String numAlphas = "# of Alphas : " + Integer.toString(getWidth())
    + " x " + Integer.toString(display.numAlphaLevels());
    g.drawString(numAlphas, 0, Graphics.TOP, Graphics.LEFT );

    Runtime runTime = Runtime.getRuntime();
    y += Font.getDefaultFont().getHeight();
    String TotalMem = "Total memory :" + Long.toString(runTime.totalMemory()/ 1024)
    + "KB";
    g.drawString(TotalMem, 0, y, Graphics.TOP | Graphics.LEFT);
    y += Font.getDefaultFont().getHeight();
    String FreeMem = "Free Memory : " + Long.toString(runTime.freeMemory()/1024)
    + "KB" ;
    g.drawString(FreeMem, 0, y, Graphics.TOP | Graphics.LEFT);
    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You're not implementing all the methods of a class that either implements an interface or extends an abstract class.

    Solution: implement all the necessary methods. The API will tell you what those are.

  3. #3
    just_in_deed is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default

    Thanks is working fine now

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2010, 05:12 PM
  2. Replies: 3
    Last Post: 09-16-2009, 09:27 PM
  3. Replies: 6
    Last Post: 02-11-2009, 10:51 AM
  4. Replies: 2
    Last Post: 11-21-2008, 12:20 AM
  5. Replies: 6
    Last Post: 10-27-2008, 12:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •