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

📄 counteritem.java

📁 J2ME手机游戏开发技术详解,适合初学者阅读使用
💻 JAVA
字号:
import javax.microedition.lcdui.*;

// A custom component for MIDP 2.0 that wraps
// a CounterArea instance.

public class CounterItem extends CustomItem
                         implements CounterArea.Callback {

    public CounterItem(){
        super( null );

        _area = new CounterArea();
        _area.setCallback( this );
    }

    public Font getFont(){
        return _area.getFont();
    }

    public int getMinContentHeight(){
        return _area.getMinHeight();
    }

    public int getMinContentWidth(){
        return _area.getMinWidth();
    }

    public int getPrefContentHeight( int width ){
        return getMinContentHeight();
    }

    public int getPrefContentWidth( int height ){
        return getMinContentWidth();
    }

    public int getValue(){
        return _area.getValue();
    }

    protected void hideNotify(){
        _area.stop();
    }

    public void invalidateCounter( CounterArea counter ){
        if( counter == _area ){
            invalidate();
        }
    }

    protected void paint( Graphics g, int width, int height ){
        _area.paint( g );
    }

    public void repaintCounter( CounterArea counter ){
        if( counter == _area ){
            repaint();
        }
    }

    public void resizeCounter( CounterArea counter ){
        if( counter == _area ){
            invalidate();
        }
    }

    protected void sizeChanged( int w, int h ){
        _area.setWidth( w );
        _area.setHeight( h );
    }

    public void setFont( Font f ){
        _area.setFont( f );
    }

    public void setValue( int value ){
        _area.setValue( value );
    }

    protected void showNotify(){
        _area.start();
    }

    public boolean traverse( int dir, int vw, int vh,
                             int[] vrect ){
        return false;
    }

    private CounterArea _area;
}

⌨️ 快捷键说明

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