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