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

📄 alerttype.java

📁 有关j2me的很好的例子可以研究一下
💻 JAVA
字号:
/* * @(#)AlertType.java	1.9 01/07/10 * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved. * * This software is the confidential and proprietary information of Sun * Microsystems, Inc. ("Confidential Information").  You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Sun. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING * THIS SOFTWARE OR ITS DERIVATIVES. */package javax.microedition.lcdui;/** * The AlertType provides an indication of the nature of alerts. * Alerts are used by an application to present various kinds of * information to the user.  * An AlertType may be used to directly signal the user without changing * the current Displayable. * The <code>playSound</code> method can be used to spontaneously * generate a sound to alert the user.  For example, a game using a  * Canvas can use <code>playSound</code> to indicate success or progress. * * The predefined types are <CODE>INFO</CODE>, <CODE>WARNING</CODE>, * <CODE>ERROR</CODE>, <CODE>ALARM</CODE>, and <CODE>CONFIRMATION</CODE>. * <p> *  * @see Alert */public class AlertType {    /**     * Information Alert identifier     */    static final int ALERT_INFO = 1;    /**     * Warning Alert identifier     */    static final int ALERT_WARN = 2;    /**     * Error Alert identifier     */    static final int ALERT_ERR  = 3;    /**     * Alarm Alert identifier     */    static final int ALERT_ALRM = 4;    /**     * Confirmation Alert identifier     */    static final int ALERT_CFM  = 5;      /**     * An INFO AlertType typically provides non-threatening information to the     * user. For example, a simple splash screen might be an INFO AlertType.     */    public static final AlertType INFO = new AlertType(ALERT_INFO);    /**     * A WARNING AlertType is a hint to warn the user of a potentially     * dangerous operation.     * For example, the warning message may contain the message, "Warning:     * this operation will erase your data."     */    public static final AlertType WARNING = new AlertType(ALERT_WARN);    /**     * An ERROR AlertType is a hint to alert the user to an erroneous operation.     * For example, an error alert might show the message,     * "There is not enough room to install the application."     */    public static final AlertType ERROR = new AlertType(ALERT_ERR);        /**     * An ALARM AlertType is a hint to alert the user to an event for which     * the user has previously requested to be notified.     * For example, the message might say, "Staff meeting in five minutes."     */    public static final AlertType ALARM = new AlertType(ALERT_ALRM);        /**     * A CONFIRMATION AlertType is a hint to confirm user actions.     * For example, "Saved!" might be shown to indicate that a Save      * operation has completed.     */    public static final AlertType CONFIRMATION = new AlertType(ALERT_CFM);    /**     * Protected constructor for subclasses.     */    protected AlertType() {    }    /**     * Alert the user by playing the sound for this AlertType.     * The AlertType instance is used as a hint by the device     * to generate an appropriate sound.  Instances other than     * those predefined above may be ignored.     * The actual sound made by the device,     * if any, is determined by the device. The device may     * ignore the request, use the same sound for     * several AlertTypes or use any other means suitable to alert      * the user.     *     * @param display to which the AlertType's sound should be played.     * @return <code>true</code> if the user was alerted,     *		<code>false</code> otherwise.     * @throws NullPointerException if <code>display</code> is <code>null</code>     */    public boolean playSound(Display display) {        synchronized (Display.LCDUILock) {            return display.playAlertSound(this);        }    }    /* we don't need a subclass...this private implementation will do. */    /**     * The type of this AlertType     */    private int type;    /**     * Create a new AlertType given the type identifier     *     * @param type  The type of the new AlertType     */    AlertType(int type) {        this.type = type;    }    /**     * Get the type of this AlertType     *     * @return int  The typer identifer of this AlertType, one of:     *              ALERT_INFO, ALERT_WARN, ALERT_ERR, ALERT_ALRM, ALERT_CFM     */    int getType() {        return this.type;    }}

⌨️ 快捷键说明

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