javauis/tsrc/fute/lcdui/Midp_General/src/Midp_General_02.java
branchRCL_3
changeset 24 6c158198356e
equal deleted inserted replaced
23:e5618cc85d74 24:6c158198356e
       
     1 /*
       
     2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19  * import midp classes.
       
    20  */
       
    21 import javax.microedition.midlet.*;
       
    22 import javax.microedition.lcdui.*;
       
    23 
       
    24 /**
       
    25  *  This is the main class for the Midp_General_02 tests.
       
    26  */
       
    27 
       
    28 public class Midp_General_02 extends MIDlet implements CommandListener
       
    29 {
       
    30 
       
    31     TextBox tb;
       
    32     Display display;
       
    33     private Command cmdExit = new Command("Exit", Command.EXIT, 1);
       
    34 
       
    35     String theText = "This is a TextBox with very long text blah blah blah blah blah blah" +
       
    36                      "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" +
       
    37                      "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" +
       
    38                      "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" +
       
    39                      "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" +
       
    40                      "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" +
       
    41                      "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" +
       
    42                      "This is the last sentence.";
       
    43 
       
    44     public Midp_General_02()
       
    45     {
       
    46         tb = new TextBox("TextBox", theText, 1000, TextField.ANY);
       
    47         tb.addCommand(cmdExit);
       
    48         tb.setCommandListener(this);
       
    49         display = Display.getDisplay(this);
       
    50     }
       
    51 
       
    52     /**
       
    53      * Signals the MIDlet to start and enter the Active state.
       
    54      */
       
    55     protected void startApp()
       
    56     {
       
    57         display.setCurrent(tb);
       
    58     }
       
    59 
       
    60     /**
       
    61      *  Signals the MIDlet to terminate and enter the Destroyed state.
       
    62      *
       
    63      */
       
    64     protected void destroyApp(boolean unconditional)
       
    65     {
       
    66     }
       
    67 
       
    68     /**
       
    69      *  Signals the MIDlet to stop and enter the Paused state.
       
    70      */
       
    71     protected void pauseApp()
       
    72     {
       
    73     }
       
    74 
       
    75     /**
       
    76      *  This method handles command invocations.
       
    77      *
       
    78      *@param  c  This is the command responsible for the event.
       
    79      *@param  s  Should be equal to this.
       
    80      */
       
    81     public void commandAction(Command c, Displayable s)
       
    82     {
       
    83         if (c == cmdExit)
       
    84         {
       
    85             destroyApp(false);
       
    86             notifyDestroyed();
       
    87         }
       
    88     }
       
    89 }