?? welcomeui.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 + -