J2ME, reapint() -> redraw, how to clear screen?

B

Boki

Hi All,

J2ME, reapint() -> redraw, how to clear screen? ( CLS )

Thanks!

Best regards,
Boki.
 
M

Mike

J2ME, reapint() -> redraw, how to clear screen? ( CLS )

Graphics g ...
..set color...
g.fillRect( 0, 0, g.getWidth(), g.getHeight());
 
B

Boki

Hi,
Got the idea, thanks.
So, I guess we don't have clear screen command here, right ? :)

another question,
if I want to command g of graphic in other plaec ( run(), startApp(),
xxxxx() )...
I have to reference it ?

Example will helpful to me :D

Best regards,
Boki.
 
D

Darryl Pierce

Boki said:
Hi All,

J2ME, reapint() -> redraw, how to clear screen? ( CLS )

In your Canvas.paint(Graphics) method, set the color in the Graphics
object and then call fillRect(0,0,getWidth(),getHeight()).
 
D

Darryl Pierce

Boki said:
if I want to command g of graphic in other plaec ( run(), startApp(),
xxxxx() )...
I have to reference it ?

No. Once paint() exits, the Graphics object is invalid and should not be
used.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top