this a sample application extends PopupScreen[1]

import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
public class PasswordPopupScreen extends PopupScreen implements
   KeyListener, TrackwheelListener {
   private String _response;
   // This EditField in RIM API provides built in password
   // masking so the password does not appear on the screen
   // as the user enters it
   private PasswordEditField answer;

   // Hard coded password, normally it is a better idea to have
   // the password stored in an internal RecordStore but here
   // it is hard coded for simplification
   private String password = "password";
   public PasswordPopupScreen()
   {
       super(new VerticalFieldManager(),Field.FOCUSABLE);
       LabelField question = new LabelField("Please enter password");
       answer = new PasswordEditField(" ","");
       add(question);
       add(new SeparatorField());
       add(answer);
   }
   // This function gets called if the password gets called
   // it pops the password screen and pushes the apps main screen
   public void accept() {
       UiApplication.getUiApplication().popScreen(this);
   }
   public void close() {
       UiApplication.getUiApplication().popScreen(this);
   }
   public String getResponse() {
       return _response;
   }
   ////////////////////////////////////////////
   /// implementation of TrackwheelListener
   ////////////////////////////////////////////
   public boolean trackwheelClick(int status, int time) {
       _response = answer.getText();
       if (_response.equals(password)) {
           accept();
       }
       else {
           Dialog.alert("Invalid Password !");
       }
       return true;
   }
   /** Invoked when the trackwheel is released */
   public boolean trackwheelUnclick(int status, int time) {
       return false;
   }
   /** Invoked when the trackwheel is rolled. */
   public boolean trackwheelRoll(int amount, int status, int time) {
       return true;
   }
   /////////////////////////////////////
   /// implementation of Keylistener
   /////////////////////////////////////
   public boolean keyChar(char key, int status, int time) {
       //intercept the ESC key - exit the app on its receipt
       boolean retval = false;
       switch (key) {
           case Characters.ENTER:
               _response = answer.getText();
               if (_response.equals(password)) {
                   accept();
               }
               // an alert is displayed if the password is incorrect
               else {
                   Dialog.alert("Invalid Password !");
               }
               retval = true;
               break;
           case Characters.ESCAPE:
               close();
               break;
           default:
               retval = super.keyChar(key,status,time);
       }
       return retval;
   }
   /** Implementation of KeyListener.keyDown */
   public boolean keyDown(int keycode, int time) {
       return false;
   }
   /** Implementation of KeyListener.keyRepeat */
   public boolean keyRepeat(int keycode, int time) {
       return false;
   }
   /** Implementation of KeyListener.keyStatus */
   public boolean keyStatus(int keycode, int time) {
       return false;
   }
   /** Implementation of KeyListener.keyUp */
   public boolean keyUp(int keycode, int time) {
       return false;
   }
}

[1] http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/How_to_-_Protect_BlackBerry_applications_with_a_password_screen.html?nodeid=800506&vernum=0