protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
}
}
/*
* Created on 2004-9-24
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author E2412C
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class WelcomeCanvas extends Canvas
{
public static final String welcome = "Press any key to start";
private Display display;
private Displayable next;
private Timer timer = new Timer();
private int width = getWidth();
private int height = getHeight();
private int i = height;
private int left;
private int fontHeight;
private boolean going = true;
public WelcomeCanvas(Display display,Displayable disp) {
super();
Font font = Font.getDefaultFont();
left = (width - font.stringWidth(welcome))/2;
fontHeight = font.getHeight();
this.display = display;
this.next = disp;
ScrollTask st = new ScrollTask();
timer.schedule(st, 100, 100);
}
protected void paint(Graphics arg0)
{
int oldColor = arg0.getColor();
arg0.setColor(255, 255, 255);
arg0.fillRect(0, 0, width, height);
arg0.setColor(oldColor);
arg0.drawString(welcome, left, i, Graphics.LEFT | Graphics.TOP);
}
public void keyPressed(int keyCode)
{
if(!going)
display.setCurrent(next);
}
private class ScrollTask extends TimerTask
{
public void run()
{
if (i > height / 2)
{
i = i - fontHeight;
repaint();
} else
{
going = false;
timer.cancel();
}