Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2003

    Repaint only works if I output text before or after

    I'm experiencing difficulty with my J2ME application using FullCanvas and the Series 40 Emulator.
    For some reason the repaint() doesn't work, the screen is left blank, but if I place a System.out.println() call just before or after the repaint() call, it works. Can anyone tell me what is going on here ?

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Mar 2003

    RE: Repaint only works if I output text before or after

    Its hard to answer without further details of your code.
    However, keep in mind that the repaint() method does not assure the screen is repainted exactly when you call it. If you want to force the VM to repaint the screen use serviceRepaints() (in Canvas class - inherited by fullCanvas as well) to "[...]Force any pending repaint requests to be serviced immediately[...]" [MIDP specs].
    When you call the System.out.println(..) method your app. stops for a little bit to send your string (or whatever it is) to the standard output, and that delay forces indirectly the pending repaint of the screen to be served.

    Hope this helps

Posting Permissions

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