Two Laptop Bag
The moose likes Java Micro Edition and the fly likes clear screen in MIDP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "clear screen in MIDP" Watch "clear screen in MIDP" New topic

clear screen in MIDP

glen kaatz

Joined: Apr 29, 2001
Posts: 6
I have a class that extends Canvas. I want to clear the screen after I have drawn on it. I noticed there is no Graphics.clear(). How should I clear the screen?
Eric Giguere
Ranch Hand

Joined: Oct 25, 2000
Posts: 170
Set the background color and fill the screen, as in:
protected void paint( Graphics g )
g.setColor( 255, 255, 255 );
g.fillRect( 0, 0, getWidth(), getHeight() );

Eric Giguere
Author/Co-Author of: Mobile Information Device Profile for Java 2 Micro Edition: Professional Developer's Guide, Java 2 Micro Edition: Professional Developer's Guide and PalmTM Database Programming: The Complete Developer's Guide
I agree. Here's the link:
subject: clear screen in MIDP
It's not a secret anymore!