⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 welcomeui.java

📁 RMS记录集源码
💻 JAVA
字号:
/*
 * Created on 2004-6-20
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.north.phonebook.ui;

import java.io.IOException;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.*;

/**
 * @author P2800
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class WelcomeUI extends Canvas
{

    private int width;
    private int height;
    private Image image;
    private String message = Title.author;
    private String school = Title.school;

    public WelcomeUI()
    {
        width = this.getWidth();
        height = this.getHeight();
        image = createImage("/welcome.png");
        
    }
    
    public Image createImage(String name)
    {
        Image image = null;
        try
        {
            image = Image.createImage(name);
        }
        catch(IOException e)
        {
            	
        }
        return image;
    }

    public void setMessage(String message)
    {
        this.message = message;
        this.repaint();
    }

    public void setSchool(String school)
    {
        this.school = school;
        repaint();
    }

    /*
     * (non-Javadoc)
     * 
     * @see javax.microedition.lcdui.Displayable#paint(javax.microedition.lcdui.Graphics)
     */
    protected void paint(Graphics arg0)
    {
        // TODO Auto-generated method stub
        //arg0.setColor(128, 128, 255);
        //arg0.drawRect(5, 5, width - 10, height - 10);
        if(image!=null)
        {
            arg0.drawImage(image,(width-image.getWidth())/2,
                    (height-image.getHeight())/2,Graphics.TOP|Graphics.LEFT);
        }
        /*
        if (message != null)
        {
            arg0.drawString(message, width / 2, height / 3, Graphics.BOTTOM
                    | Graphics.HCENTER);
        }
        if (school != null)
        {
            arg0.drawString(school, width / 2, height * 2 / 3, Graphics.BOTTOM
                    | Graphics.HCENTER);
        }
        */
    }

}

⌨️ 快捷键说明

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