📄 canv.java
字号:
package Calc;
import java.io.*;
import java.lang.*;import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.microedition.lcdui.*;import javax.microedition.lcdui.game.*;public class Canv extends Canvas implements Runnable { private Display display; private CommandListener listener; private Thread othread, mythread;
private int nthrd;
private boolean paintAll = true;
private KeyPaint keypaint;
public Canv() {
keypaint = new KeyPaint(getWidth(), getHeight()); } protected void keyRepeated(int k) { } protected void keyReleased(int k) { }
protected void pointerPressed(int i, int j) { }
protected void keyPressed(int k) {
keypaint.setPressedKey(k, getGameAction(k));
paintAll(true);
} //public void setCommandListener(CommandListener l) { // super.setCommandListener(l); // listener = l; //} protected void showNotify() { othread = new Thread(this); othread.start(); } protected void hideNotify() { othread = null; } public void destroy() { hideNotify(); //stop run() }
private final String int2str(int i2) {
if(i2 >= 10)
{return "" + i2;}
else
{return "0" + i2;}
}
public void setLeftRight() {
keypaint.setCurrentPad(2); //表明将另外一个设为活动的
paintAll(true);
}
public void setRight(int right) {
keypaint.setRightPad(right); //向后变一个,-1向前变一个
paintAll(true);
}
public void run() { //Graphics g = getGraphics(); // Of the buffered screen image //mythread = Thread.curPadrentThread();
//if (mythread == othread) { }
nthrd = 1;
while (nthrd > 0) {
try {
mythread.sleep(5000);
//paintAll(true);
//nthrd++;
} catch (java.lang.InterruptedException e) { nthrd = -1;}
}
othread = null; }
private void paintAll(boolean tr) {
paintAll = tr;
repaint();
}
public void paint(Graphics g) { if (!paintAll) {return;}
//g.setColor(0xff0000);
//g.fillRect(0, 0, getWidth(), getHeight());
keypaint.paintAll(g, paintAll);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -