#ff0000 24  2005 . - #000655     .  
#def   Mobile Information Device Profile (MIDP)    ,      .   "MIDP  API  "     API  .      .         " " .
 " "  ,     .             (    ,   drawLine  drawArc),    -     ,   ,        .     ,     .  ,      ,            .           ,     .        .
 MIDP     .    Image (         javax.microedition.lcdui)    .       ,     ,    Graphics.       ,     Graphics. ,           .
 ,     -  ,        .      .  ,     paint  canvas,  Graphics,   ,    ,  .         .  ,    ,   isDoubleBuffered:
public class MyCanvas extends Canvas {

   private Image offscreen = null;
   private int height;
   private int width;

   public MyCanvas(){
     height = getHeight();
     width = getWidth();

   if( !isDoubleBuffered() ){
     offscreen = Image.createImage( width, height );
     }

     ..... // other initialization as appropriate
   }

   ...... // other code, including paint method
}
   .  isDoubleBuffered  false,    ,     .     , isDoubleBuffered  true    .
    Image.createImage.     .
   JAR . 
   . 
      . 
    . 
     .    ,    ,   ,       .     ,     getGraphics    Graphics,        .
     paint.    , , :
protected void paint( Graphics g ){
   g.setColor( 255, 255, 255 );
   g.fillRect( 0, 0, width, height );
} 

    paint  ,    .             .   :
protected void paint( Graphics g ){
   Graphics saved = g;

   if( offscreen != null ){
     g = offscreen.getGraphics();
   }

   g.setColor( 255, 255, 255 );
   g.fillRect( 0, 0, width, height );

   if( g != saved ){
   saved.drawImage( offscreen, 0, 0,
     Graphics.LEFT | Graphics.TOP );
   }
} 
, ,    ,    Graphics       .    ,       . ,    ,       .        ,     .   ,     ,      .
   ,       :        .        (  ,       )     ,    . /       hideNotify  showNotify  canvas.     ,       .                     .
#0000ff   Eric Giguere .
#0000ff : aRix