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

📄 bqimageitem.java

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

public class BQImageItem extends BQItem {
    
    private BQImage img;

    private BQImage mutImg;

    private String altText;

    private int vertPad;

    private int appearanceMode;

    private int originalAppearanceMode;

    private final static int HYPERLINK_PAD = 3;
    
    public BQImageItem(String label, BQImage img, int layout, String altText) {
        super(label);
       
        setImageImpl(img);
        setLayoutImpl(layout);
        this.altText = altText;

    }
    
    public BQImageItem(String label, BQImage img, int layout, String altText, int appearanceMode) {
        this(label,img,layout,altText);
        switch (appearanceMode) {
        case Item.PLAIN:
        case Item.HYPERLINK:
        case Item.BUTTON:
            this.appearanceMode = appearanceMode;
            break;
        default:
            throw new IllegalArgumentException();
        }
    }

    public BQImage getImage() {
        return mutImg == null ? img : mutImg;
    }

    public void setImage(BQImage img) {
        setImageImpl(img);
        invalidate();
    }

    public String getAltText() { 
        // SYNC NOTE: return of atomic value, no locking necessary
        return altText;
    }

    public void setAltText(String text) {
        // SYNC NOTE: atomic, no locking necessary
        this.altText = text;
    }

    public int getMLayout() {
        // NOTE: looks odd, but this method is required for 1.0 compatiblitiy
        return super.getMLayout();
    }

    public void setLayout(int layout) {
        // NOTE: looks odd, but this method is required for 1.0 compatiblitiy
        super.setLayout(layout);
    }

    public int getAppearanceMode() {
        return appearanceMode;
    }

    private void setImageImpl(BQImage img) {
        if (img != null && img.isMutable()) {
            this.mutImg = img;
            this.img = BQImage.createImage(img); // use immutable copy of img
        } else { 
            this.mutImg = null;
            this.img = img;
        }
    }

    /**
     * Set the alternate text for this ImageItem
     *
     * @param text The alternate text for this ImageItem
     */
    private void setAltTextImpl(String text) {
        this.altText = text;
    }

    int callPreferredWidth(int height) {
        // TODO Auto-generated method stub
        return 0;
    }

    int callPreferredHeight(int width) {
        // TODO Auto-generated method stub
        return 0;
    }

    int callMinimumWidth() {
        // TODO Auto-generated method stub
        return 0;
    }

    int callMinimumHeight() {
        // TODO Auto-generated method stub
        return 0;
    }

}

⌨️ 快捷键说明

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