⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layer.java

📁 J2me唆哈的代码
💻 JAVA
字号:
/*
 * Created on 2005-12-20 by pcy
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package javax.microedition.lcdui.game;
import javax.microedition.lcdui.Graphics;

public abstract class Layer {

    int x; // = 0;

    int y; // = 0;

    int width; // = 0;

    int height; // = 0;

    boolean visible ;
    
    Layer(int width, int height) {
        super();
        if(width<0||height<0){
            throw new IllegalArgumentException();
        }
        setWidthImpl(width);
        setHeightImpl(height);
        visible=true;
    }
    
    public void setPosition(int x, int y) {
        this.x = x;
        this.y = y;
    }
    
    public void move(int dx, int dy) {  
        x += dx;
        y += dy;
    }
    
    public final int getX() {
        return x;
    }
    
    public final int getY() {
        return y;
    }
    
    public final int getWidth() {
        return width;
    }
    
    public final int getHeight() {
        return height;
    }
    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public final boolean isVisible() {
        return visible;
    }

    public abstract void paint(Graphics g);
    
    void setWidthImpl(int width) { 
        if (width < 0) {
            throw new IllegalArgumentException();
        }
        this.width = width;
    }

    void setHeightImpl(int height) {
        if (height < 0) {
            throw new IllegalArgumentException();
        }
        this.height = height;
    }
}

⌨️ 快捷键说明

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