numscreen.java

来自「为解压缩文件」· Java 代码 · 共 71 行

JAVA
71 行
字号
/*
 * Created on 2004-12-21
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.j2medev.numbergame;

import java.util.Timer;
import java.util.TimerTask;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Font;

import com.nokia.mid.ui.FullCanvas;

public abstract class NumScreen extends FullCanvas
{
    protected Timer timer = new Timer();
    protected Display display;
    protected Manager next;
    protected int timeout;
    protected Font font;
    
    public NumScreen(Display display,Manager next)
    {
        this.display = display;
        this.next = next;

        setTimeout(3000);
    }
    
    public Font getFont()
    {
        if(font == null)
        {
            font = Font.getDefaultFont();
        }
        return font;
    }
    
    public void setFont(Font font)
    {
        this.font = font;
    }
    
    public void setTimeout(int time)
    {
        this.timeout = time;
    }
    
    
    public void dismiss()
    {
        timer.cancel();
        display.setCurrent(next);
    }
    
    public void showNotify()
    {
        timer.schedule(new TimerTask()
                {
            		public void run()
            		{
            		    dismiss();
            		}
                },3000);
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?