×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    How to force repaint?

    Hello everyone,

    I'm novice to Java and don't know all the tricks unfortunately. I've encountered a small problem:

    I have one screen (based on TextBox) where user enters some information. Then information is processed and another screen appears. It might take up to 5 seconds to process this info, so I would like to show a label with "Please wait..." on it. So before calling the function that does all the processing bits I'm changing display (display.setcurrent) to the different one (with "please wait" label) and straight after that calling my processing function. But the screen does NOT change until the processing completes. How I can force application to change the screen first and only then proccess futher?

    Any help would be appretiated.

    Thanks, Alex

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    382

    RE: How to force repaint?

    After the information is entered to the textbox,
    and command is pressed,

    set the wait screen and after
    start the thread which is prosessing the data.

    public void commandAction(Command c, Displayable s) {
    if (c.getCommandType() == Command.EXIT)
    notifyDestroyed();
    else if (c.getCommandType() == Command.BACK)
    mDisplay.setCurrent(mMainScreen);
    else if (c.getCommandType() == Command.OK) {
    // Put up a wait screen.
    Form waitForm = new Form("Processing..."
    mDisplay.setCurrent(waitForm);
    // start processing
    Thread t = new Thread(this);
    t.start();
    }
    }

    // Runnable method for processing

    public void run() {


    Form resultsForm = new Form("Results"
    Command backCommand =
    new Command("Back", Command.BACK, 0);
    resultsForm.addCommand(backCommand);
    resultsForm.setCommandListener(this);

    // after processing you have your data top show

    resultsForm.append(message);
    mDisplay.setCurrent(resultsForm);


    Hope this will help you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×