001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /*
043: * HelloMidlet.java
044: *
045: * Created on 13. duben 2005, 19:27
046: */
047: package hello;
048:
049: import javax.microedition.midlet.*;
050: import javax.microedition.lcdui.*;
051:
052: /**
053: *
054: * @author bohemius
055: */
056: public class HelloMidlet extends MIDlet implements
057: javax.microedition.lcdui.CommandListener {
058:
059: /** Creates a new instance of HelloMidlet */
060: public HelloMidlet() {
061: }
062:
063: // --- This section is auto-generated by NetBeans IDE. Do not modify or you may lose your changes.//<editor-fold id="MVDMethods" defaultstate="collapsed" desc="This section is auto-generated by NetBeans IDE.">//GEN-BEGIN:MVDMethods
064: /**
065: * This method initializes UI of the application.
066: */
067: private void initialize() {
068: // For adding user code into this block, select "Design" item in the inspector and invoke property editor on Action property in Properties window.
069: javax.microedition.lcdui.Display.getDisplay(this ).setCurrent(
070: get_helloForm());
071: }
072:
073: /**
074: * Called by the system to indicate that a command has been invoked on a particular displayable.
075: * @param command the Command that ws invoked
076: * @param displayable the Displayable on which the command was invoked
077: **/
078: public void commandAction(javax.microedition.lcdui.Command command,
079: javax.microedition.lcdui.Displayable displayable) {
080: if (displayable == helloForm) {
081: if (command == exitCommand) {
082: // For adding user code into this block, select "Design | Screens | helloForm [Form] | Assigned Commands | exitCommand" item in the inspector and invoke property editor on Action property in Properties window.
083: javax.microedition.lcdui.Display.getDisplay(this )
084: .setCurrent(null);
085: destroyApp(true);
086: notifyDestroyed();
087: }
088: }
089: }
090:
091: /**
092: * This method returns instance for helloForm component and should be called instead of accessing helloForm field directly.
093: * @return Instance for helloForm component
094: **/
095: private javax.microedition.lcdui.Form get_helloForm() {
096: if (helloForm == null) {
097: helloForm = new javax.microedition.lcdui.Form(
098: null,
099: new javax.microedition.lcdui.Item[] { get_helloStringItem() });
100: helloForm.addCommand(get_exitCommand());
101: helloForm.setCommandListener(this );
102: }
103: return helloForm;
104: }
105:
106: /**
107: * This method returns instance for helloStringItem component and should be called instead of accessing helloStringItem field directly.
108: * @return Instance for helloStringItem component
109: **/
110: private javax.microedition.lcdui.StringItem get_helloStringItem() {
111: if (helloStringItem == null) {
112: helloStringItem = new javax.microedition.lcdui.StringItem(
113: "Hello", "Hello, World!");
114: }
115: return helloStringItem;
116: }
117:
118: /**
119: * This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.
120: * @return Instance for exitCommand component
121: **/
122: private javax.microedition.lcdui.Command get_exitCommand() {
123: if (exitCommand == null) {
124: exitCommand = new javax.microedition.lcdui.Command("Exit",
125: javax.microedition.lcdui.Command.EXIT, 1);
126: }
127: return exitCommand;
128: }
129:
130: javax.microedition.lcdui.Form helloForm;
131: javax.microedition.lcdui.StringItem helloStringItem;
132: javax.microedition.lcdui.Command exitCommand;
133:
134: // --- This is the end of auto-generated section.//</editor-fold>//GEN-END:MVDMethods
135:
136: public void startApp() {
137: initialize();
138: }
139:
140: public void pauseApp() {
141: }
142:
143: public void destroyApp(boolean unconditional) {
144: }
145:
146: }
|