亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? textarea.java

?? 開發(fā)j2me 手機程序必須的用到的。文件較小
?? JAVA
字號:
package com.jmobilecore.ui.core;

import javax.microedition.lcdui.*;

/**
 * A <code>textArea</code> object is a text component
 * that allows for the editing of a single line of text.
 *
 * @author Evgeniy Krapiva
 * @author Greg Gridin
 */
public class TextArea extends TextComponent {

    /**
     * By words wrapping style
     */
    static public final byte WORD_WRAPPING = 1;

    /**
     * By symbol wrapping style
     */
    static public final byte SYMBOL_WRAPPING = 2;

    /**
     * Default height of component
     */
    final static public int ROWS = 3;

    /**
     * The number of rows in the <code>TextArea</code>.
     * This parameter will determine the text area's height.
     */
    public int rows;

    /**
     * Handles input of the number keys
     */
    public TextAreaComposer composer;

    /**
     * Enables or disables text input.
     */
    boolean active = false;

    /**
     * Constructs a new text area with the empty string as text.
     */
    public TextArea() {
        this(null, ROWS, C_ANY);
    }

    /**
     * Constructs a new text area with the specified text.
     *
     * @param text the text to be displayed; if text is null, the empty string "" will be displayed
     */
    public TextArea(String text) {
        this(text, ROWS, C_ANY);
    }

    /**
     * Constructs a new text area with the specified number of rows and the empty string as text.
     *
     * @param nRows the number of rows
     */
    public TextArea(int nRows) {
        this(null, nRows, C_ANY);
    }

    /**
     * Constructs a new text area with the specified text, and with the specified number of rows
     *
     * @param text  the text to be displayed; if text is null, the empty string "" will be displayed
     * @param nRows the number of rows
     */
    public TextArea(String text, int nRows) {
        this(text, nRows, C_ANY);
    }

    /**
     * Constructs a new text area with the specified number of rows, the binary mask of constraints
     * and the empty string as text.
     *
     * @param nRows  the number of rows
     * @param constr constraints binary mask
     */
    public TextArea(int nRows, int constr) {
        this(null, nRows, constr);
    }

    /**
     * Constructs a new text area with the specified text, the specified number of rows
     * and binary mask constraints
     *
     * @param text   the text to be displayed; if text is null, the empty string "" will be displayed
     * @param nRows  the number of rows
     * @param constr constraints binary mask
     */
    public TextArea(String text, int nRows, int constr) {
        super(constr);
        rows = nRows;
        if (rows < 1) rows = ROWS;
        focusedForeground = Style.FOCUSED_TEXT_COLOR;
        foreground = Style.TEXT_COLOR;
        setFont(Style.TEXT_FIELD_FONT);

        composer = new TextAreaComposer(rows, getWidth() - (BORDER_WIDTH + BORDER_GAP + Style.H_GAP), font);
        setText(text);
    }

    /**
     * Returns the text that is presented by this text component.
     */
    public String getText() {
        return composer.getText();
    }

    /**
     * Sets the text that is presented by this
     * text component to be the specified text.
     *
     * @param newText the new text.
     */
    public void setText(String newText) {
        composer.setText(newText);
    }

    /**
     * Gets current input composer
     */
    protected AbstractComposer getComposer() {
        return composer;
    }

    /**
     * Appends the given text to the text area's current text.
     */
    public void append(String str) {
        composer.appendText(str);
    }

    /**
     * Inserts the specified text at the specified position
     * in this text area.
     */
    public void insert(String str, int pos) {
        composer.insertText(str, pos);
    }

    /**
     * Sets the font of this component.
     *
     * @param font the font to become this component's font;
     *             if this parameter is <code>null</code> then this
     *             component font won't be changed
     */
    public void setFont(Font font) {
        super.setFont(font);
        if (composer != null) composer.reset(font);
    }

    /**
     * Sets the component wrapping style
     *
     * @param style indicates new wrapping style
     * @see #WORD_WRAPPING
     * @see #SYMBOL_WRAPPING
     */
    public void setWrappingStyle(byte style) {
        composer.wrappingStyle = style;
        composer.reset(font);
    }

    /**
     * Paints the component
     *
     * @param g Graphics object
     */
    public void paint(Graphics g) {
        final int voffset = BORDER_WIDTH + BORDER_GAP + Style.V_GAP;
        final int hoffset = BORDER_WIDTH + BORDER_GAP + Style.H_GAP;

        paintBackground(g);
        g.setColor(Style.BORDER_COLOR);
        g.drawRect(0, screenY, width - 1, height - 1);
        prepareForeground(g);
        int y = screenY + voffset;

        //paint the text !!!
        TextAreaComposer.LineRange range;
        String text = composer.getText();

        //paint from current string
        for (int i = composer.startRow; i < composer.startRow + rows; i++) {
            //get ranges for current string
            try {
                range = (TextAreaComposer.LineRange) composer.linebreaks.elementAt(i);
            } catch (Exception e) {
                break;
            }

            if (alignment == LEFT || active) {
                g.drawSubstring(text, range.from, range.to-range.from, hoffset, y, Graphics.TOP | Graphics.LEFT);
            } else if (alignment == RIGHT) {
                g.drawSubstring(text, range.from, range.to-range.from, getWidth() - hoffset, y, Graphics.TOP | Graphics.RIGHT);
            } else if (alignment == CENTER) {
                g.drawSubstring(text, range.from, range.to-range.from, getWidth() / 2, y, Graphics.TOP | Graphics.HCENTER);
            }
            y += font.getHeight();
        }
        super.paint(g);

        if (active) if (isFocusOwner()) paintCursor(g);
    }

    /**
     * Calculates the height of the component.
     */
    protected void setHeight() {
        this.height = font.getHeight() * rows + 2 * Style.V_GAP +
                BORDER_WIDTH * 2 + BORDER_GAP * 2;
    }

    /**
     * Paints the cursor for this component
     *
     * @param g Graphics object
     */
    protected void paintCursor(Graphics g) {
        //displays selected symbol and caret position
        final int cp = composer.caretPositionX + composer.currentRange.from;
        final int voffset = BORDER_WIDTH + BORDER_GAP + Style.V_GAP;
        final int hoffset = BORDER_WIDTH + BORDER_GAP + Style.H_GAP;
        final int cY = screenY + voffset + composer.caretPositionY * font.getHeight();
        final int rh = font.getHeight();

        int lineOffset = hoffset;
        for (int i = composer.currentRange.from; i < cp; i++) {
            lineOffset += font.charWidth(composer.text.charAt(i));
        }

        g.setColor(Style.CURSOR_BACKGROUND_COLOR);

        if (!insertMode) {
            final char ch = composer.text.charAt(cp);
            final int cw = font.charWidth(ch);
            g.fillRect(lineOffset, cY, cw + 1, rh);
            g.setColor(Style.CURSOR_TEXT_COLOR);
            g.setClip(lineOffset, cY, cw, rh);
            g.drawChar(ch, lineOffset, cY, Graphics.TOP | Graphics.LEFT);
            g.setClip(0, 0, ScreenCanvas.WIDTH, ScreenCanvas.HEIGHT);

        } else
            g.fillRect(lineOffset, cY, 1, rh);
    }

    /**
     * Responds to a key press.
     * <p/>
     * If the key is a number key and the constraint is {@link TextComponent#C_NUMERIC} only,
     * no timing interval is used, the number is immediately inserted into the
     * field (if there is room).
     * If the key is a number key and the constraint IS NOT ONLY {@link TextComponent#C_NUMERIC},
     * the timing interval begins so that
     * characters may be cycled through via repeated presses of the same key
     * within the timing interval.
     * <p/>
     * Presses of the left and right sides of the 4-way navigation key move the
     * cursor one character left or right within the field. Pressing the <b>*</b>
     * key deletes the character to the left of the cursor. Pressing the <b>#</b>
     * key inserts a space at the cursor position.
     * <p/>
     * You can override this method if you want a custom component to perform
     * additional filtering of key presses.  For example, if you want a field that
     * accepts only odd digits you could extend this class, ensure it is
     * {@link TextComponent#C_NUMERIC}, then in this method check that the pressed key is an odd
     * digit before passing it to the parent's <code>keyPressed</code> method.
     *
     * @param keyCode The code for the key that was pressed.
     * @return <code>true</code> if the key was successfully processed, <code>false</code> otherwise
     */
    synchronized public boolean keyPressed(int keyCode) {

        boolean bRes = false;

        resetCursor();
        final boolean curInsertMode = insertMode;
        if (!curInsertMode && preProcessKeyCode(keyCode)) {
            if (active) composer.caretRight();
        }

        //Activation of TextArea component
        if (keyCode == PlatformCanvas.KEY_ENTER) {
            active = !active;
            bRes = true;
        }

        if (keyCode == PlatformCanvas.KEY_LEFT) {
            if (active) bRes = composer.caretLeft();
        }
        if (keyCode == PlatformCanvas.KEY_RIGHT) {
            if (active) bRes = composer.caretRight();
        }
        if (keyCode == PlatformCanvas.KEY_UP) {
            if (active) bRes = composer.caretUp();
        }
        if (keyCode == PlatformCanvas.KEY_DOWN) {
            if (active) bRes = composer.caretDown();
        }

        if (editable) {

            if (keyCode == PlatformCanvas.KEY_STAR || keyCode == PlatformCanvas.KEY_CLEAR) {
                bRes = composer.backspace();
            }

            if (active) {
                if (keyCode == PlatformCanvas.KEY_POUND || (keyCode >= PlatformCanvas.KEY_NUM0 && keyCode <= PlatformCanvas.KEY_NUM9)) {
                    char ch = processKeyCode(keyCode);
                    if (ch == 0) return false;
                    bRes = composer.addChar(ch, curInsertMode);
                    if (insertMode) composer.caretRight();
                }
            }
        }
        if (bRes) parentScreen.repaint();

        initCursor();
        lastKeyCode = keyCode;
        return bRes;
    }
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久嫩草精品久久久精品| 91影视在线播放| 精品欧美乱码久久久久久| 午夜a成v人精品| 91精品国产欧美一区二区成人| 亚洲高清久久久| 91麻豆精品国产自产在线观看一区 | 中文字幕一区二区三区四区不卡| 国产一区999| 国产精品乱人伦中文| 一本色道**综合亚洲精品蜜桃冫| 一区二区三区在线观看国产| 欧美二区乱c少妇| 久久疯狂做爰流白浆xx| 久久九九全国免费| 色综合久久综合中文综合网| 亚洲国产成人av好男人在线观看| 9191精品国产综合久久久久久| 久久99久久精品| 国产精品理伦片| 欧美日韩一区二区三区四区| 免费高清视频精品| 国产精品青草综合久久久久99| 色婷婷综合久久| 久久精品999| 亚洲日本中文字幕区| 在线综合视频播放| 成人黄色免费短视频| 亚洲国产另类av| 国产亚洲精品精华液| 欧美三级日韩三级| 国产超碰在线一区| 午夜精品福利一区二区三区av | 亚洲欧美日韩国产综合在线| 7777女厕盗摄久久久| 成人三级在线视频| 日本午夜一区二区| 亚洲女同女同女同女同女同69| 欧美一级爆毛片| 日本精品免费观看高清观看| 久久精品999| 亚洲一区二区黄色| 中文一区二区完整视频在线观看| 欧美精品久久天天躁| 成人一区二区在线观看| 蜜臀99久久精品久久久久久软件| 亚洲欧洲av一区二区三区久久| 日韩免费视频一区二区| 在线看不卡av| 99re这里都是精品| 国产一区二区不卡在线| 日韩成人精品在线观看| 亚洲黄色片在线观看| 中文字幕乱码亚洲精品一区| 精品美女在线观看| 91精品国产综合久久婷婷香蕉| 91视频在线看| av电影在线不卡| 国产**成人网毛片九色 | 久草热8精品视频在线观看| 一级精品视频在线观看宜春院| 国产亚洲欧洲一区高清在线观看| 日韩视频一区二区在线观看| 在线观看亚洲a| 色综合久久久久久久| 午夜成人免费电影| 亚洲电影在线免费观看| 亚洲综合在线观看视频| 中文字幕日韩av资源站| 国产精品网站在线| 中文字幕免费一区| 中文字幕不卡在线观看| 国产欧美精品一区二区色综合 | 从欧美一区二区三区| 久久精品国产秦先生| 久久国产欧美日韩精品| 久色婷婷小香蕉久久| 麻豆国产精品视频| 久久99九九99精品| 国产精一品亚洲二区在线视频| 韩国三级电影一区二区| 精品一区二区三区免费毛片爱| 久久99精品久久久| 国产老肥熟一区二区三区| 国产成人精品一区二| 国产高清不卡一区| av不卡在线观看| 色婷婷综合中文久久一本| 日本韩国视频一区二区| 欧美日韩免费高清一区色橹橹 | 亚洲bt欧美bt精品777| 午夜精品久久久久久久| 另类小说一区二区三区| 国产又黄又大久久| 成人一区二区三区| 91成人在线观看喷潮| 欧美日韩国产精品自在自线| 91麻豆精品91久久久久久清纯 | 欧美在线不卡视频| 欧美高清视频一二三区| 日韩精品中文字幕一区二区三区 | 成人中文字幕合集| 色综合一个色综合| 91精品国产综合久久蜜臀| 精品国产123| 亚洲人成伊人成综合网小说| 亚洲v日本v欧美v久久精品| 蜜桃精品视频在线观看| 国产成人福利片| 在线观看视频91| 日韩免费电影一区| 国产精品理伦片| 石原莉奈一区二区三区在线观看| 久久99精品网久久| 97精品国产97久久久久久久久久久久| 欧美亚洲日本国产| 久久久久久久久久久黄色| 综合色天天鬼久久鬼色| 日韩电影一二三区| 成人午夜激情影院| 4438亚洲最大| 日韩美女视频一区二区 | 在线观看av一区| 久久久亚洲欧洲日产国码αv| 中文字幕中文乱码欧美一区二区| 亚洲国产日韩精品| 成人久久久精品乱码一区二区三区 | 亚洲综合久久久| 国产精品一级片在线观看| 欧美日韩专区在线| 国产精品美女久久久久久久| 日韩一区精品视频| 一本在线高清不卡dvd| 337p日本欧洲亚洲大胆精品| 亚洲综合色视频| av在线一区二区三区| 日韩免费视频线观看| 午夜激情综合网| 91亚洲国产成人精品一区二三| 精品成人一区二区| 免费美女久久99| 精品视频全国免费看| 国产精品人人做人人爽人人添| 毛片基地黄久久久久久天堂| 欧美性极品少妇| 亚洲人成网站精品片在线观看| 国产麻豆精品theporn| 日韩欧美综合在线| 日本欧美一区二区三区| 欧洲av一区二区嗯嗯嗯啊| 中文字幕佐山爱一区二区免费| 国产精品白丝jk白祙喷水网站| 欧美一级爆毛片| 日韩电影在线一区二区三区| 欧美日韩三级一区二区| 亚洲精品久久久蜜桃| 99久久国产综合色|国产精品| 久久久久久久久蜜桃| 韩国欧美国产1区| 日韩免费在线观看| 极品少妇一区二区| 精品国产成人系列| 国产永久精品大片wwwapp| 日韩欧美国产精品| 久久99国产精品久久99果冻传媒| 欧美精品丝袜中出| 三级久久三级久久| 91精品国产福利在线观看 | 国产精品超碰97尤物18| 成人晚上爱看视频| 日韩理论片中文av| 色婷婷国产精品| 一个色综合网站| 欧美日韩国产首页| 男人的天堂亚洲一区| 日韩欧美一级二级| 国产毛片一区二区| 中文字幕欧美三区| 91免费视频网址| 亚洲国产精品天堂| 制服丝袜中文字幕一区| 久久精品国产久精国产| 久久免费电影网| www.日韩精品| 亚洲国产精品久久人人爱蜜臀| 777xxx欧美| 国产福利不卡视频| 最新热久久免费视频| 欧美视频中文字幕| 久久99热狠狠色一区二区| 国产午夜精品福利| 色88888久久久久久影院野外 | 热久久久久久久| 精品国产一区二区精华| 成人av先锋影音| 亚洲国产人成综合网站| 精品乱人伦一区二区三区| 波多野洁衣一区| 日韩中文字幕91| 国产人伦精品一区二区|