📄 congscreen.java
字号:
package com.j2medev.numbergame;
import java.io.IOException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public class CongScreen extends NumScreen
{
private String title;
private Mark mark;
private Image image;
private Image star;
private Manager manager;
private int number;
private int type = CONG;
public static final int CONG = 1;
public static final int WARNING = 2;
public CongScreen(Display display, Manager next)
{
super(display, next);
}
public CongScreen(Display display,Manager next, Mark mark)
{
this(display, next);
this.mark = mark;
}
protected void paint(Graphics g)
{
int width = this.getWidth();
int height = this.getHeight();
if (image == null)
{
try
{
image = Image.createImage("/cong.png");
star = Image.createImage("/star.png");
} catch (IOException e)
{
e.printStackTrace();
}
}
if (title != null)
{
g.drawString(title, width / 2, 5, Graphics.HCENTER | Graphics.TOP);
}
int offset = 10 + getFont().getHeight();
g.drawImage(image, 2, offset, Graphics.TOP | Graphics.LEFT);
offset = offset + image.getHeight();
if(type == CONG)
{
//number = 5 - mark.getCount()/2;
if(number ==0) number = 1;
g.drawString("成绩:",2,offset+3,Graphics.TOP|Graphics.LEFT);
for(int i = 0;i<number;i++)
{
g.drawImage(star,4+font.stringWidth("成绩:")+i*star.getWidth(),offset+3,Graphics.LEFT|Graphics.TOP);
}
}
}
public void setNumber(int i)
{
this.number = 5-i/2;
}
public void setType(int type)
{
this.type = type;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public Mark getMark()
{
return mark;
}
public void setMark(Mark mark)
{
this.mark = mark;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -