×

Discussion Board

Results 1 to 2 of 2

Thread: Full Canvas

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    11

    Full Canvas

    I am trying to paint the whole of the screen to create a game.
    Below is the source code of two classes which i am trying to do this with. But for some reason it is not painting the whole screen
    Thankyou for your help.

    import java.io.PrintStream;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;

    public class SpeedingRacer extends MIDlet {

    public Display display;
    private GameCanvas gameCanvas;

    public SpeedingRacer() {
    display = Display.getDisplay(this);
    gameCanvas = new GameCanvas(this);
    }

    protected void startApp(){
    display.setCurrent(gameCanvas);

    }

    protected void pauseApp(){
    }

    protected void destroyApp(boolean unconditional){
    }

    } // SpeedingRacer

    public class GameCanvas extends FullCanvas {

    private SpeedingRacer speedingRacer;

    public GameCanvas(SpeedingRacer speedingRacer) {
    this.speedingRacer = speedingRacer;
    }

    protected void paint(Graphics g){
    g.setColor(85,251,251);
    g.fillRect(0,0,getWidth(),getHeight());
    }

    } // GameCanvas

    Thankyou

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    If the device you're using is a Series 60 device like the 7650 or the 3650 (I don't know if this is fixed on the 6600), then the FullCanvas has a bug where getHeight() returns the height of a normal Canvas (144) instead of the real height (208).

    shmoove

Posting Permissions

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