📄 weiqicanvas.java
字号:
package com.wqssyq;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
public class WeiqiCanvas extends Canvas{
int x=0;
int y=0;
int bs = 0;
protected void paint(Graphics g) {
for(int i=0; i<19; i++)
{
g.drawLine(12, 12+12*i, 228, 12+12*i);
}
for(int i=0; i<19; i++)
{
g.drawLine(12+12*i, 12, 12+12*i, 228);
}
if(x>0 && y>0)
{
if((bs/2)*2!=bs)
{
g.fillArc(x-5, y-5, 10, 10, 0, 360);
}
else
{
g.drawArc(x-5, y-5, 10, 10, 0, 360);
}
}
}
protected void pointerPressed(int x, int y)
{
this.x = (int)(x/12.0+0.5)*12;
this.y = (int)(y/12.0+0.5)*12;
bs++;
this.repaint();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -