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

📄 inputmode.java

📁 有关j2me的很好的例子可以研究一下
💻 JAVA
字号:
/* * 01/08/21 @(#)InputMode.java	1.9 * * Copyright (c) 2000-2001 Sun Microsystems, Inc., 901 San Antonio Road, * Palo Alto, CA 94303, U.S.A.  All Rights Reserved. * * Sun Microsystems, Inc. has intellectual property rights relating * to the technology embodied in this software.  In particular, and * without limitation, these intellectual property rights may include * one or more U.S. patents, foreign patents, or pending * applications.  Sun, Sun Microsystems, the Sun logo, Java, KJava, * and all Sun-based and Java-based marks are trademarks or * registered trademarks of Sun Microsystems, Inc.  in the United * States and other countries. * * This software is distributed under licenses restricting its use, * copying, distribution, and decompilation.  No part of this * software may be reproduced in any form by any means without prior * written authorization of Sun and its licensors, if any. * * FEDERAL ACQUISITIONS:  Commercial Software -- Government Users * Subject to Standard License Terms and Conditions *//* * Note: InputMode and its agents such as InputModeHelper and * InputModeClient are left as is for reference.  InputMode used to be * of another public package com.sun.microedition.io.  Since such the * external package class can not access directly to a member in the * public package javax.microedition.lcdui class, InputModeClient was * created to act as an agent between com.sun.microedition.io and * javax.microedition.lcdui working with InputModeHelper.   */package com.sun.midp.lcdui;import java.lang.String;import javax.microedition.lcdui.TextBox;import javax.microedition.lcdui.TextField;import com.sun.midp.lcdui.InputModeHelper;/** * InputModes are associated with text input elements of the LCDUI * package.  InputModes are hints from the application to the device * that allow the device to provide alternative input mechanisms that may * be appropriate for the usage, language and input device.  Each InputMode * is named.  Names should be chosen from the subsets of the Unicode character * set as declared in the JDK 1.3 java.Character.Subset classes. * Specifically, java.awt.im.InputSubset and java.lang.Character.UnicodeBlock * define named blocks of the Unicode character space.  The names * of those static * declarations should be used as the names of InputModes. * The set of InputModes supported is device specific. * Mode names are case-sensitive Strings and compared using the normal String * compare and equality functions. * <p> * For each TextBox or TextField the current and available * InputModes can be set and retrieved. It is an error to set the * current InputMode to a method not supported by the device. * The current InputMode does not need to be one of the available InputModes. * The available InputMode list is used by the device to provide the user * with a more limited set of choices for which InputMode to use. * </p> * <p> * Typical InputMode names might be: <code>KANJI, HALFWIDTH_KATAKANA, * etc </code> Devices may define other input modes. * </p> * * @see javax.microedition.lcdui.TextBox * @see javax.microedition.lcdui.TextField */public class InputMode {    /** Private constructor for static class. */    private InputMode() {}    /**     * The InputModes that are available on this device are returned.     * Each name is valid to use with the setInputMode method.     * @return an array of InputMode names.     */    public static String[] supportedInputModes() {	return InputModeHelper.supportedInputModes();    }    /**     * Set the InputMode(s) to be available to the specified TextBox.     * Any InputMode not supported by the device is ignored.     * If the none of the inputmode is supported by the device     * or if the array is empty the device may select the inputmode.     * @param textbox a TextBox for which to set the InputModes     * @param inputmodes an array of input method names     *     * @see #getAllowedModes     */    public static void setAllowedModes(TextBox textbox, String[] inputmodes) {        InputModeHelper.setAllowedModes(textbox, inputmodes);    }    /**     * Get the InputMode(s) for the specified TextBox.     * Only the names of InputModes supported by the device are returned.     *     * @param textbox a TextBox from which to get the InputModes.     * @return an array of available and supported InputMode names.     * <code>null</code> is returned if none have been set for the TextBox or     * if no InputModes are defined.     *     * @see #setAllowedModes     */    public static String[] getAllowedModes(TextBox textbox) {        return InputModeHelper.getAllowedModes(textbox);    }    /**     * Set the InputMode for the specified TextBox.     * It must be one of the InputMode names returned by      * <code>supportedInputModes</code>.     *     * @param textbox a TextBox for which to set the input method.     * @param inputmode the InputMode for the TextBox.     *	If <code>null</code> is passed the implementation will     *	choose the InputMode.     * @exception NullPointerException is thrown TextBox is <code>null</code>     * @exception IllegalArgumentException is thrown if inputmode     * is not supported by the device.     *     * @see #getMode     */    public static void setMode(TextBox textbox, String inputmode) {        InputModeHelper.setMode(textbox, inputmode);    }    /**     * Get the InputMode name for the specified TextBox.     * If one has not been set with setInputMode the default one     * chosen by the device is returned.     *     * @param textbox a TextBox from which to get the input method.     * @return the current InputMode for the TextBox.     * @exception NullPointerException is thrown TextBox is <code>null</code>     *     * @see #setMode     */    public static String getMode(TextBox textbox) {        return InputModeHelper.getMode(textbox);    }    /**     * Set the InputMode(s) to be available to the specified TextField.     * Any InputMode not supported by the device is ignored.     * If the none of the inputmode is supported by the device     * or if the array is empty the device may select the inputmode.     *     * @param tf a TextField for which to set the InputModes     * @param inputmodes an array of input method names     *     * @see #getAllowedModes     */    public static void setAllowedModes(TextField tf, String[] inputmodes) {        InputModeHelper.setAllowedModes(tf, inputmodes);    }    /**     * Get the InputMode(s) for the specified TextField.     * Only the names of InputModes supported by the device are returned.     *     * @param tf a TextField from which to get the InputModes.     * @return an array of available and supported InputMode names.     * <code>null</code> is returned if none have been set for the TextField or     * if no InputModes are defined.     *      * @see #setAllowedModes     */    public static String[] getAllowedModes(TextField tf) {        return InputModeHelper.getAllowedModes(tf);    }    /**     * Set the InputMode for the specified TextField.     * It must be one of the InputMode names returned by      * <code>supportedInputModes</code>.     *     * @param tf a TextField for which to set the input method.     * @param inputmode the InputMode for the TextField.     *	If <code>null</code> is passed the implementation will     *	choose the InputMode.     * @exception NullPointerException is thrown TextField is <code>null</code>     * @exception IllegalArgumentException is thrown if inputmode     * is not supported by the device.     *     * @see #getMode     */    public static void setMode(TextField tf, String inputmode) {        InputModeHelper.setMode(tf, inputmode);    }    /**     * Get the InputMode name for the specified TextField.     * If one has not been set with setInputMode the default one     * chosen by the device is returned.     *     * @param tf a TextField from which to get the input method.     * @return the current InputMode for the TextField.     * @exception NullPointerException is thrown TextField is <code>null</code>     *     * @see #setMode     */    public static String getMode(TextField tf) {        return InputModeHelper.getMode(tf);    }}

⌨️ 快捷键说明

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