Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

newbie: midp problems

Thread view: 
Jeff - 15 Dec 2005 22:22 GMT
Hey

midp 2.0
J2ME Wireless Toolkit 2.2
JDK 5

When running this code, the loginForm is shown for a fraction of a second
and I don't have to click out of the loginForm.. I want the midlet to
display the login form until the user clicks out of it (he chooses "OK" or
"EXIT"), but Now I can hardly see it before the canvas fill the display....
I think the problem is related to what code I place in the Test constructor
and startApp:

So please give me a suggestion that will make the loginForm to be shown
until the user clicks out of it, and then if the user had clicked "OK" the
canvas is shown

Jeff

public Test()
{
    display   = Display.getDisplay(this);
    private TestThread testThread;
     private TestCanvas testCanvas;
     private boolean m_LoggedIn;
     loginForm   = new LoginForm("Login");
     exitCommand  = new Command("Exit", Command.EXIT, 99);
     okCommand   = new Command("Ok", Command.OK, 1);
     pauseCommand  = new Command("Pause", Command.SCREEN, 1);

     m_LoggedIn = false;
     loginForm.addCommand(exitCommand);
     loginForm.addCommand(okCommand);
     loginForm.setCommandListener(this);
     display.setCurrent(loginForm);
}
//*********************************************************************
public void startApp() throws MIDletStateChangeException {
   if (!m_LoggedIn) {
       m_LoggedIn = testLogin(loginForm.username(), loginForm.password());
       if (m_LoggedIn) {
           testCanvas = new TestCanvas(this);
           testCanvas.addCommand(exitCommand);
           testCanvas.addCommand(okCommand);
           testCanvas.setCommandListener(this);
       }
   }
   else if (m_LoggedIn) {
       if (testCanvas != null) {
           if (testThread == null) {
               testThread = new TestThread(testCanvas);
               testCanvas.start();
               testThread.start();
             }
       }
   }
}
//**************************************************************************
public void commandAction(Command c, Displayable s) {
   if (c == okCommand) {
       testCanvas.flushKeys();
       testThread.resumeMidp();
       if (s.getTitle() == "Login") {
      }
}
Jeff - 17 Dec 2005 21:48 GMT
> Hey
>
[quoted text clipped - 61 lines]
>       }
> }


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.