Source Code Cross Referenced for AlertType.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package javax.microedition.lcdui;
028:
029:        import com.sun.midp.configurator.AlertTypeConstants;
030:
031:        /**
032:         * The <code>AlertType</code> provides an indication of the nature
033:         * of alerts.
034:         * <code>Alerts</code> are used by an application to present
035:         * various kinds of
036:         * information to the user. 
037:         * An <code>AlertType</code> may be used to directly signal the
038:         * user without changing
039:         * the current <code>Displayable</code>.
040:         * The <code>playSound</code> method can be used to spontaneously
041:         * generate a sound to alert the user.  For example, a game using a 
042:         * <code>Canvas</code> can use <code>playSound</code> to indicate
043:         * success or progress.
044:         *
045:         * The predefined types are <CODE>INFO</CODE>, <CODE>WARNING</CODE>,
046:         * <CODE>ERROR</CODE>, <CODE>ALARM</CODE>, and <CODE>CONFIRMATION</CODE>.
047:         * <p>
048:         * 
049:         * @see Alert
050:         * @since MIDP 1.0
051:         */
052:        public class AlertType {
053:
054:            /**
055:             * An <code>INFO</code> <code>AlertType</code> typically
056:             * provides non-threatening information to the
057:             * user. For example, a simple splash screen might be an
058:             * <code>INFO</code> <code>AlertType</code>.
059:             */
060:            public static final AlertType INFO = new AlertType(
061:                    AlertTypeConstants.LCDUI_ALERT_TYPE_INFO);
062:
063:            /**
064:             * A <code>WARNING</code> <code>AlertType</code> is a hint
065:             * to warn the user of a potentially
066:             * dangerous operation.
067:             * For example, the warning message may contain the message, &quot;Warning:
068:             * this operation will erase your data.&quot;
069:             */
070:            public static final AlertType WARNING = new AlertType(
071:                    AlertTypeConstants.LCDUI_ALERT_TYPE_WARNING);
072:
073:            /**
074:             * An <code>ERROR</code> <code>AlertType</code> is a hint
075:             * to alert the user to an erroneous operation.
076:             * For example, an error alert might show the message,
077:             * &quot;There is not enough room to install the application.&quot;
078:             */
079:            public static final AlertType ERROR = new AlertType(
080:                    AlertTypeConstants.LCDUI_ALERT_TYPE_ERROR);
081:
082:            /**
083:             * An <code>ALARM</code> <code>AlertType</code> is a hint
084:             * to alert the user to an event for which
085:             * the user has previously requested to be notified.
086:             * For example, the message might say, &quot;Staff meeting in five
087:             * minutes.&quot;
088:             */
089:            public static final AlertType ALARM = new AlertType(
090:                    AlertTypeConstants.LCDUI_ALERT_TYPE_ALARM);
091:
092:            /**
093:             * A <code>CONFIRMATION</code> <code>AlertType</code> is a
094:             * hint to confirm user actions.
095:             * For example, &quot;Saved!&quot; might be shown to indicate that a Save 
096:             * operation has completed.
097:             */
098:            public static final AlertType CONFIRMATION = new AlertType(
099:                    AlertTypeConstants.LCDUI_ALERT_TYPE_CONFIRMATION);
100:
101:            /**
102:             * Protected constructor for subclasses.
103:             */
104:            protected AlertType() {
105:            }
106:
107:            /**
108:             * Alert the user by playing the sound for this
109:             * <code>AlertType</code>.
110:             * The <code>AlertType</code> instance is used as a hint by the device
111:             * to generate an appropriate sound.  Instances other than
112:             * those predefined above may be ignored.
113:             * The actual sound made by the device,
114:             * if any, is determined by the device. The device may
115:             * ignore the request, use the same sound for
116:             * several <code>AlertTypes</code> or use any other means
117:             * suitable to alert
118:             * the user.
119:             *
120:             * @param display to which the <code>AlertType's</code> sound
121:             * should be played.
122:             * @return <code>true</code> if the user was alerted,
123:             * <code>false</code> otherwise.
124:             * @exception NullPointerException if <code>display</code> is 
125:             * <code>null</code>
126:             */
127:            public boolean playSound(Display display) {
128:                synchronized (Display.LCDUILock) {
129:                    return display.playAlertSound(this );
130:                }
131:            }
132:
133:            /**
134:             * Create a new AlertType given the type identifier
135:             *
136:             * @param type  The type of the new AlertType
137:             */
138:            AlertType(int type) {
139:                this .type = type;
140:            }
141:
142:            /**
143:             * Get the type of this AlertType
144:             *
145:             * @return int  The typer identifer of this AlertType, one of:
146:             *              ALERT_INFO, ALERT_WARN, ALERT_ERR, ALERT_ALRM, ALERT_CFM
147:             */
148:            int getType() {
149:                return this .type;
150:            }
151:
152:            /**
153:             * The type of this AlertType
154:             */
155:            private int type;
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.