#ff0000 5  2005 . - #000655     MIDlet-
#def       ,        .         ,       .        ,       .          . 
  MIDP   ,            (,        : MIDlet suit).        .   ,     ,   JAR .     ,    ,     . 
      -         .               .         "" . 
    ,   TextBox  TextField.       javax.microedition.lcdui. TextBox   ,  ,     .    -    ,  TextField. TextField -   ,     .  -  ,        . TextBox  TextField   ,        . 
     ,     :    :   ? , ,   ,      .        . ,       ,            .   ,  ,    ,  ,    .    . ,       ,       . 
       TextBox.
//     
//    .

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class PasswordPrompter
          extends TextBox
          implements CommandListener {

    private Display display;
    private Displayable next;
    private int pin;

    //      

    public PasswordPrompter( int pin,
                             int maxchars,
                             Display display,
                             Displayable next ){
        this( defaultTitle, pin, maxchars,
              display, next );
    }

    //    

    public PasswordPrompter( String title,
                             int pin,
                             int maxchars,
                             Display display,
                             Displayable next ){
        super( title, "", maxchars,
              TextField.NUMERIC | TextField.PASSWORD );

        addCommand( okCommand );
        setCommandListener( this );

        this.display = display;
        this.next = next;
        this.pin = pin;

        display.setCurrent( this );
    }

    //   .  
    //   pin.   , 
    //    ,   - 
    //  .

    public void commandAction( Command c,
                               Displayable d ){
        String pinStr = getString();

        try {
            if( Integer.parseInt( pinStr ) == pin ){
                display.setCurrent( next );
                return;
            }
        }
        catch( NumberFormatException e ){
        }

        Alert alert = new Alert( "Error!",
                                 "Invalid password",
                                 null,
                                 AlertType.ERROR );

        setString( "" );
        display.setCurrent( alert, this );
    }

    private static final Command okCommand =
              new Command( "OK", Command.OK, 1 );

    private static final String defaultTitle =
             "Enter Password";
}

   ,  ,    ,   ,   ,  ,      .    ,   . 
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class PasswordTester extends MIDlet
                      implements CommandListener {

    private Display display;
    private Command exitCommand
             = new Command( "Exit", Command.EXIT, 1 );

    public PasswordTester(){
    }

    protected void destroyApp( boolean unconditional )
                   throws MIDletStateChangeException {
        exitMIDlet();
    }

    protected void pauseApp(){
    }

    protected void startApp()
                throws MIDletStateChangeException {
        if( display == null ){ //  ...
            initMIDlet();
        }
    }

    private void initMIDlet(){
        display = Display.getDisplay( this );

        //  

        new PasswordPrompter( 1234, 4, display,
                              new TrivialForm() );
    }

    public void exitMIDlet(){
        notifyDestroyed();
    }

    public void commandAction( 
                            Command c, Displayable d ){
        exitMIDlet();
    }

    // ,    

    class TrivialForm extends Form {
        TrivialForm(){
            super( "MainApp" );
            addCommand( exitCommand );
            setCommandListener( PasswordTester.this );
        }
    }
}

        .      .          RSM (record store maintained)     / .        getAppProperty: 

MIDlet midlet = ....;
int password;

try {
    String p = midlet.getAppProperty( "Password" );
    password = Integer.parseInt( p );
}
catch( NumberFormatException e ){
}
        . ,      ,            e-mail. 
 ,         ,          /.    ,    .   RSM    .       ,     .