newbie: midp problems

J

Jeff

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") {
}
}
 
J

Jeff

Jeff said:
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") {
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,888
Messages
2,569,964
Members
46,294
Latest member
HollieYork

Latest Threads

Top