something.java

来自「一款支持蓝牙传输的游戏」· Java 代码 · 共 41 行

JAVA
41
字号
import java.io.IOException;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
import java.util.Random;
/*
 * Something.java
 *
 * Created on 2007年4月2日, 上午10:30
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author MissYou
 */
public class Something extends Target{
    Random randomtool = new Random();
    static private int MAXVALUE = 750; 
    /** Creates a new instance of Something */
    public Something(){
        super();
    }
    
    public Something( int x, int y ) {
        String filename = "/Something.png";
        int size =randomtool.nextInt(5);
        try{        
            super.setAll(x, y, size, new Sprite(Image.createImage(filename)) );
        }catch( IOException ioe ){
            System.out.println("Can't Load Something file.");
        }
    }
    
    public int getRelValue(){
        return randomtool.nextInt(MAXVALUE);
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?