File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Canvas re sizing and repainting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Canvas re sizing and repainting" Watch "Canvas re sizing and repainting" New topic

Canvas re sizing and repainting

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hi all, i am developing an application which displays non english characters using an image. The repaint is done only to the part of the canvas, so that the existing characters drawn earlier remain to unchanged. Some times the existing characters gets cleared, but thats some times, any idea why this is happening. My second question is how can i make the canvas bigger once it exceeds the size of the display so that the user can scroll down and continue typing? Thanks alot in advance. Anticipating a quick reply...

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
Maybe you could consider using the LayerManager
in the MIDP Game classes. It allows you to set a view port
over an area that may be bigger than the screen.

You can define a Sprite from an image and then add it
to a LayerManager. I am not sure if it will solve your problem but it may be worth checking it out. Check the MIDP 2.0 documentation for details.

It may also be easier to work with GameCanvas rather than Canvas, which
is a bit "funny" in terms of repaint behaviour. At least GameCanvas (in theory) ensures that when you call flushGraphics() the screen gets updated

PS: Ransinka, I am glad to see you're actively developing using J2ME ...
[ March 31, 2006: Message edited by: Eduardo Marques ]

Eduardo Marques
Get ready for your SCMAD certification at - See what all the buzz is about ...
I agree. Here's the link:
subject: Canvas re sizing and repainting
It's not a secret anymore!