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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? textcomponent.java

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

import java.util.TimerTask;
import java.util.Timer;

/**
 * The <code>TextComponent</code> class is the superclass of
 * any component that allows the editing of some text.
 * <p/>
 * The <code>TextComponent</code> class defines a set of methods
 * that supports text editing using phone keypad.
 *
 * @author Greg Gridin
 */
abstract public class TextComponent extends Component {

    /**
     * Constraints for the document
     */
    protected int constraint = C_NO_CHARS;

    /**
     * Numeric characters
     */
    protected static final String NUMERIC_CHARS = "0123456789";

    /**
     * Uppercase characters
     */
    protected static final String UC_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    /**
     * Lowercase characters
     */
    protected static final String LC_CHARS = "abcdefghijklmnopqrstuvwxyz";

    /**
     * Email special characters
     */
    protected static final String EMAIL_SPEC_CHARS = "~_.@";

    /**
     * Space character
     */
    protected static final String SPACE_CHARS = " ";

    /**
     * All special character
     */
    protected static final String ALL_SPEC_CHARS = " ~`!@#$%^&*()_-+=\\|'\".,/?<>:;[]";


    /**
     * Do not allows any chars
     */
    public static final int C_NO_CHARS = 0x00;

    /**
     * Allows numbers in the document
     * @see #NUMERIC_CHARS
     */
    public static final int C_NUMERIC = 0x01;

    /**
     * Allows lowercase letters in the document
     * @see #LC_CHARS
     */
    public static final int C_LOWER_CASE = 0x02;

    /**
     * Allows uppercase letters in the document
     * @see #UC_CHARS
     */
    public static final int C_UPPER_CASE = 0x04;

    /**
     * Allows email special letters in the document
     * @see #EMAIL_SPEC_CHARS
     */
    public static final int C_EMAIL_SPEC_CHARS = 0x08;

    /**
     * Allows spaces in the document
     * @see #SPACE_CHARS
     */
    public static final int C_SPACE = 0x10;

    /**
     * Allows all special characters in the document
     * @see #ALL_SPEC_CHARS
     */
    public static final int C_ALL_SPEC_CHARS = 0x80;

    /**
     * Allows all alphabet characters and space in the document
     */
    public static final int C_ALPHA = C_LOWER_CASE | C_UPPER_CASE | C_SPACE;

    /**
     * Allows alphanumeric characters in the document
     */
    public static final int C_ALPHA_NUMERIC = C_ALPHA | C_NUMERIC;

    /**
     * Allows all email characters in the document
     */
    public static final int C_EMAIL =
            C_ALPHA_NUMERIC | C_EMAIL_SPEC_CHARS ^ C_SPACE;

    /**
     * Allows any characters in the document
     */
    public static final int C_ANY = 0xFF;

    /**
     * The array of allowed characted
     */
    protected char[] validChars = null;

    /**
     * Indicated if text component is in insert mode
     */
    volatile protected boolean insertMode = true;

    /**
     * Index into <code>charOptionCounter</code> for the last character used.
     */
    volatile protected int charOptionCounter = 0;

    /**
     * The characters, mapped to the number keys
     */
    final static protected char[][] CHAR_OPTIONS = {
        {'0', '+'},
        {'1', '.', '-', '\'', '+', '!', '\"', '*', '#', '$', '%', '(', ')', '@', '&', '_',
         '~', '`', '^', '=', '\\', '|', ',', '/', '?', '<', '>', ':', ';', '[', ']'},
        {'A', 'B', 'C', 'a', 'b', 'c', '2'},
        {'D', 'E', 'F', 'd', 'e', 'f', '3'},
        {'G', 'H', 'I', 'g', 'h', 'i', '4'},
        {'J', 'K', 'L', 'j', 'k', 'l', '5'},
        {'M', 'N', 'O', 'm', 'n', 'o', '6'},
        {'P', 'Q', 'R', 'S', 'p', 'q', 'r', 's', '7'},
        {'T', 'U', 'V', 't', 'u', 'v', '8'},
        {'W', 'X', 'Y', 'Z', 'w', 'x', 'y', 'z', '9'},
        {' '}
    };

    /**
     * Phone keys used for data input.
     */
    final static protected int[] KEY_OPTIONS = {
        PlatformCanvas.KEY_NUM0, PlatformCanvas.KEY_NUM1, PlatformCanvas.KEY_NUM2, PlatformCanvas.KEY_NUM3,
        PlatformCanvas.KEY_NUM4, PlatformCanvas.KEY_NUM5, PlatformCanvas.KEY_NUM6, PlatformCanvas.KEY_NUM7,
        PlatformCanvas.KEY_NUM8, PlatformCanvas.KEY_NUM9, PlatformCanvas.KEY_POUND
    };

    protected int lastKeyCode = 0;

    /**
     * Creates a new <code>TextComponent</code> instance.
     * @param constr Constraints for this document
     */
    public TextComponent(int constr) {
        this.constraint = constr;
        focusable = true;

        int vc = 0;
        if ((constr & C_NUMERIC) > 0) {
            vc += NUMERIC_CHARS.length();
        }
        if ((constr & C_LOWER_CASE) > 0) {
            vc += UC_CHARS.length();
        }
        if ((constr & C_UPPER_CASE) > 0) {
            vc += LC_CHARS.length();
        }
        if ((constr & C_ALL_SPEC_CHARS) > 0) {
            vc += ALL_SPEC_CHARS.length();
        } else {
            if ((constr & C_EMAIL_SPEC_CHARS) > 0) {
                vc += EMAIL_SPEC_CHARS.length();
            }
            if ((constr & C_SPACE) > 0) {
                vc += SPACE_CHARS.length();
            }
        }

        validChars = new char[vc];
        int i, len;
        vc = 0;
        if ((constr & C_NUMERIC) > 0) {
            len = NUMERIC_CHARS.length();
            for (i = 0; i < len; i++)
                validChars[vc++] = NUMERIC_CHARS.charAt(i);
        }
        if ((constr & C_LOWER_CASE) > 0) {
            len = LC_CHARS.length();
            for (i = 0; i < len; i++)
                validChars[vc++] = LC_CHARS.charAt(i);
        }
        if ((constr & C_UPPER_CASE) > 0) {
            len = UC_CHARS.length();
            for (i = 0; i < len; i++)
                validChars[vc++] = UC_CHARS.charAt(i);
        }
        if ((constr & C_ALL_SPEC_CHARS) > 0) {
            len = ALL_SPEC_CHARS.length();
            for (i = 0; i < len; i++)
                validChars[vc++] = ALL_SPEC_CHARS.charAt(i);
        } else {
            if ((constr & C_EMAIL_SPEC_CHARS) > 0) {
                len = EMAIL_SPEC_CHARS.length();
                for (i = 0; i < len; i++)
                    validChars[vc++] = EMAIL_SPEC_CHARS.charAt(i);
            }
            if ((constr & C_SPACE) > 0) {
                len = SPACE_CHARS.length();
                for (i = 0; i < len; i++)
                    validChars[vc++] = SPACE_CHARS.charAt(i);
            }
        }
    }

    /**
     * Adds valid characters for the component.
     * @param str string of valid characters
     */
    public void addValidChars(String str) {
        int strlen = str.length();
        char[] newValidChars = new char[validChars.length + strlen];
        int i;
        for (i = 0; i < validChars.length; i++) {
            newValidChars[i] = validChars[i];
        }
        for (int t = 0; t < strlen; t++) {
            newValidChars[i + t] = str.charAt(t);
        }
        validChars = newValidChars;
    }

    protected boolean preProcessKeyCode(int keyCode) {

        if (keyCode != lastKeyCode) {
            insertMode = true;
            charOptionCounter = 0;
            return true;
        }
        return false;
    }

    protected char processKeyCode(int keyCode) {

        final int keyIndex = getKeyOption(keyCode);

        if (keyIndex == -1) {
            insertMode = true;
            charOptionCounter = 0;
            return (char) keyCode;
        }

        int rc = charOptionCounter;
        final int len = CHAR_OPTIONS[keyIndex].length;
        if (rc >= len) rc %= len;

        char ch, rslt = 0;
        for (int p = 0; p < len; p++) {
            ch = CHAR_OPTIONS[keyIndex][rc];
            if (isCharValid(ch)) {
                if (rslt == 0) {
                    charOptionCounter = rc + 1;
                    rslt = ch;
                } else {
                    insertMode = false;
                    return rslt;
                }
            }
            rc = (rc + 1) % len;
        }

        insertMode = true;
        charOptionCounter = 0;
        return rslt;
    }

    /**
     * Checks if the character is allows symbol
     * @param ch test character
     * @return <code>true</code> if the characted is allwed symbol
     * for the component, <code>false</code> otherwise
     */
    protected boolean isCharValid(char ch) {
        int vcl = validChars.length;
        for (int i = 0; i < vcl; i++) {
            if (validChars[i] == ch) return true;
        }
        return false;
    }

    protected int getKeyOption(int keyCode) {
        int l = KEY_OPTIONS.length;
        for (int keyIndex = 0; keyIndex < l; keyIndex++) {
            if (KEY_OPTIONS[keyIndex] == keyCode) return keyIndex;
        }
        return -1;
    }

    /**
     * The gap between the screen border and the textfield frame
     */
    final static public int BORDER_WIDTH = 1;

    /**
     * The gap between the textfield frame and textfield text
     */
    final static public int BORDER_GAP = 1;

    /**
     * Gets the position of the text insertion caret for this text component.
     *
     * @return the position of the text insertion caret
     */
    public int getCaretPosition() {
        return getComposer().getCaretPosition();
    }

    /**
     * Sets the position of the text insertion caret for this text component.
     * The caret position is constrained to be at or before the current selection end and non-negative.
     * @param caretPosition the position of the text insertion caret
     * @return <code>true</code> if setting of caret position is possible <code>false</code>
     */
    public boolean setCaretPosition(int caretPosition) {
        return getComposer().setCaretPosition(caretPosition);
    }

    /**
     * The flag that determines whether or not this text component is editable.
     * If the flag is set to true, this text component becomes user editable.
     * If the flag is set to false, the user cannot change the text of this text component.
     */
    public boolean editable = true;

    /**
     * Gets current input composer
     */
    abstract protected AbstractComposer getComposer();

    public static final byte CURSOR_TYPE_SYMBOL = 1;

    public static final byte CURSOR_TYPE_LINE = 2;

    protected void resetCursorHandler() {

        insertMode = true;
        charOptionCounter = 0;
    }

    /**
     * Blinking rate for the curson in milliseconds
     */
    protected static final int CURSOR_DELAY = 1000;

    /**
     * The timer is used to determine if key input time is elapsed
     */
    protected Timer cHandler = null;

    /**
     * Cancels the timer
     */
    synchronized protected void resetCursor()
    {
        if (cHandler != null)
        {
            cHandler.cancel();
            cHandler = null;
        }
    }

    /**
     * Initializes new timer
     */
    protected void initCursor()
    {
        if (!insertMode)
        {
            cHandler = new Timer();
            cHandler.schedule(new CursorHandler(this), CURSOR_DELAY);
        }
    }

    /**
     * The timer task, when elapsed cursor moves to next position
     */
    class CursorHandler extends TimerTask
    {
        TextComponent parentField;

        public CursorHandler(TextComponent tf)
        {
            parentField = tf;
        }

        public void run()
        {
            resetCursorHandler();
            getComposer().caretRight();
            parentScreen.repaint();
            resetCursor();
        }
    }

    /**
     * Default destructor. Helps VM to perform garbage collection
     */
    public void destructor() {
        validChars = null;
        resetCursor();
    }

} // class TextComponent

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区四区视频| 成人av高清在线| 亚洲男人电影天堂| 国产欧美精品区一区二区三区 | 日本不卡在线视频| 亚洲自拍与偷拍| 亚洲一区二区三区国产| 亚洲美女屁股眼交3| 亚洲欧洲综合另类| 亚洲免费色视频| 亚洲综合男人的天堂| 一区二区三区四区乱视频| 亚洲色图欧美在线| 亚洲已满18点击进入久久| 亚洲免费观看视频| 亚洲资源中文字幕| 亚洲成人你懂的| 日韩高清一级片| 麻豆一区二区三| 国产一区二区毛片| jlzzjlzz亚洲女人18| 91色乱码一区二区三区| 色哟哟国产精品| 欧美性猛片xxxx免费看久爱| 欧美系列亚洲系列| 欧美一级理论片| 国产欧美视频一区二区三区| 国产精品久久久久久久久动漫| 国产精品日韩成人| 一区二区三区91| 五月激情综合网| 精品在线播放午夜| 99麻豆久久久国产精品免费优播| 97精品视频在线观看自产线路二| 色呦呦一区二区三区| 欧美一区二区三区系列电影| 久久久另类综合| 亚洲激情欧美激情| 精品在线播放免费| 91社区在线播放| 日韩一区二区影院| 国产精品福利在线播放| 亚洲成人av资源| 国产精品 欧美精品| 色久综合一二码| 久久综合丝袜日本网| 亚洲欧美国产三级| 国产一区激情在线| 欧美亚洲综合网| 国产嫩草影院久久久久| 国产.欧美.日韩| 在线观看亚洲一区| 国产欧美精品日韩区二区麻豆天美| 亚洲欧美另类综合偷拍| 麻豆一区二区三| 欧美性猛交xxxx乱大交退制版 | 日本欧美大码aⅴ在线播放| 国产精品亚洲一区二区三区妖精| 欧美性大战久久久久久久| 日本一区二区三区视频视频| 一区二区三区精品| 国产成a人亚洲| 日韩精品一区二区三区视频 | 亚洲男同1069视频| 国产精品18久久久| 久久综合狠狠综合久久综合88| 一区二区三区色| av电影天堂一区二区在线| 久久一区二区三区四区| 天涯成人国产亚洲精品一区av| 91视频观看视频| 亚洲色图视频网| 99精品在线免费| 一区在线中文字幕| 成人黄色大片在线观看| 欧美精品一区二| 日韩国产在线观看一区| 欧美性大战久久久久久久蜜臀| 亚洲欧美一区二区三区极速播放 | 国产亚洲欧美在线| 精彩视频一区二区三区| 日韩一区二区三区免费观看| 亚洲福利一区二区| 欧美日韩国产免费一区二区 | 色老头久久综合| 亚洲黄色小说网站| 在线中文字幕不卡| 亚洲自拍另类综合| 欧美日韩在线三级| 五月婷婷综合在线| 欧美一区二区精品久久911| 日韩主播视频在线| 欧美一区二区三区人| 人妖欧美一区二区| 欧美精品一区二区久久婷婷| 精品一区中文字幕| 久久久久久日产精品| 国产乱码精品一区二区三区五月婷| 久久综合99re88久久爱| 丁香亚洲综合激情啪啪综合| 亚洲欧洲精品成人久久奇米网| 91丨九色丨黑人外教| 亚洲一区二三区| 91精品欧美一区二区三区综合在 | 蜜臀久久久99精品久久久久久| 精品国产精品一区二区夜夜嗨| 国产麻豆精品theporn| 国产精品欧美一区喷水| 欧美色偷偷大香| 国内欧美视频一区二区| 国产精品久久99| 欧美日韩国产欧美日美国产精品| 久久国产精品免费| 国产精品久久网站| 欧美人与禽zozo性伦| 国产综合色精品一区二区三区| 国产精品萝li| 欧美久久一二区| 国产91露脸合集magnet| 亚洲一区二区av在线| 久久一区二区三区国产精品| 99久久久久久| 久久国产乱子精品免费女| 国产日韩欧美激情| 在线成人免费视频| 成人app在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产欧美日韩麻豆91| 欧美日韩国产小视频| 成人动漫在线一区| 麻豆视频观看网址久久| 亚洲色图制服丝袜| 久久―日本道色综合久久| 欧美亚洲日本国产| 成人中文字幕在线| 老司机免费视频一区二区三区| 亚洲男同性视频| 国产午夜精品一区二区三区嫩草 | 91精品国产综合久久精品性色| 成人国产精品免费观看视频| 狂野欧美性猛交blacked| 亚洲精品乱码久久久久久黑人| 久久综合狠狠综合久久激情| 欧美日韩国产影片| 91色婷婷久久久久合中文| 国产精品伊人色| 激情偷乱视频一区二区三区| 亚洲午夜电影网| 一区二区三区欧美日| 国产精品天干天干在线综合| 日韩欧美中文一区二区| 欧美男女性生活在线直播观看| 97久久精品人人做人人爽| 大胆欧美人体老妇| 国产二区国产一区在线观看| 麻豆精品新av中文字幕| 日本不卡免费在线视频| 五月激情综合网| 视频一区欧美精品| 亚洲成人久久影院| 亚洲一级二级三级| 亚洲成人免费视频| 日韩国产欧美三级| 日本女优在线视频一区二区| 首页国产丝袜综合| 日韩在线一区二区| 免费观看一级特黄欧美大片| 免费成人在线视频观看| 麻豆久久一区二区| 国产一区二区三区日韩| 国产乱码精品一区二区三| 国产91露脸合集magnet| eeuss鲁片一区二区三区在线观看| 成人久久视频在线观看| 91在线视频在线| 在线国产电影不卡| 91精品久久久久久久久99蜜臂| 欧美一二三四在线| 久久精品夜色噜噜亚洲a∨| 中文字幕高清不卡| 一区二区三区在线视频观看 | 亚洲一区在线观看免费| 亚洲第一狼人社区| 久久精品国产秦先生| 国产精品性做久久久久久| 成人h动漫精品| 色婷婷综合久久| 欧美一区永久视频免费观看| 日韩视频一区二区| 中文字幕精品综合| 亚洲va在线va天堂| 国产一区二区伦理| 一本色道久久综合狠狠躁的推荐 | 日韩成人伦理电影在线观看| 麻豆免费精品视频| 91亚洲精华国产精华精华液| 337p亚洲精品色噜噜| 日本一二三不卡| 午夜影视日本亚洲欧洲精品| 国产精品亚洲第一|