使用canvas实现数据过多时候的下拉
+ expand sourceview plaincopy to clipboardprint?
package ui;
import java.util.Vector;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
public class MenuCanvas extends Canvas {
private int width; //屏幕宽度
private int height; //屏幕高度
private int fontHeight; //文本高度
private static int paddingHeight = 5; //文本间隔高度
private String words = "经贸学院东";
private Vector vector = new Vector();
private int lineNumber = 0; //行号
private Font font = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE);
private int xxx;
public MenuCanvas() {
width = this.getWidth();
height = this.getHeight();
fontHeight = font.getHeight();
for (int i=0; i<20; i++) {
vector.addElement(words + i);
}
xxx = width / (fontHeight + paddingHeight);
}
protected void paint(Graphics g) {
g.setColor(255, 255, 255);
g.fillRect(0, 0, width, height);
int x = lineNumber; !--判断阅读权限-->!--判断是否已经扣点--> |