📄 covercanvas.java
字号:
// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2005-4-3 23:29:35
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: CoverCanvas.java
package NBMaJiang;
import com.nokia.mid.ui.FullCanvas;
import java.io.PrintStream;
import javax.microedition.lcdui.*;
// Referenced classes of package NBMaJiang:
// Action, ActionListener
public class CoverCanvas extends FullCanvas
implements Runnable
{
public CoverCanvas(String logo)
{
started = false;
try
{
logoImg = Image.createImage(logo);
init();
}
catch(Exception e)
{
System.out.println("wel.png not found!");
}
}
private void init()
{
width = getWidth();
height = getHeight();
Max = 10;
pos = 0;
}
public void paint(Graphics g)
{
drawBg(g);
}
private void drawBg(Graphics g)
{
g.drawImage(logoImg, 0, 0, 20);
g.setColor(255);
g.fillRect(0, 116, width, 12);
g.drawRect(0, 116, width, 11);
int tR = ((pos % 10) * 255) / Max;
for(int i = 0; i < Max; i++)
{
if(i >= pos % 10)
tR = (tR + (i * 255) / Max) % 255;
else
tR = Math.abs(tR - (i * 255) / Max) % 255;
g.setColor(tR, tR, 255);
g.fillRect((i * width) / Max, 117, width / Max + 1, 10);
}
}
synchronized void start()
{
thread = new Thread(this);
thread.start();
}
synchronized void stop()
{
thread = null;
}
public void run()
{
for(Thread current = Thread.currentThread(); thread == current;)
try
{
if(!started && isShown())
{
if(actionListener != null)
actionListener.action(new Action("", 3, -1), this);
started = true;
}
Thread.currentThread();
Thread.sleep(100L);
pos++;
if(pos > 25 && actionListener != null)
actionListener.action(new Action("", 4, -1), this);
repaint();
}
catch(InterruptedException e) { }
}
public void setActionListener(ActionListener actListener)
{
actionListener = actListener;
}
protected void showNotify()
{
start();
}
protected void hideNotify()
{
stop();
}
private boolean started;
private Image logoImg;
private int width;
private int height;
private int Max;
private int pos;
private Thread thread;
private ActionListener actionListener;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -