int w; int h; PRivate Image offImage = null; private boolean buffered = true; public SimpleCanvas(boolean _buffered){ buffered = _buffered; w = getWidth(); h = getHeight(); if(buffered) offImage = Image.createImage(w,h); } protected void paint(Graphics g) {
int color = g.getColor(); g.setColor(0xFFFFFF); g.fillRect(0,0,w,h); g.setColor(color);
Graphics save = g; if(offImage != null) g = offImage.getGraphics(); //draw the offimage g.setColor(128,128,0); g.fillRoundRect((w-100)/2,(h-60)/2,100,60,5,3); //draw the offimage to the canvas save.drawImage(offImage,0,0,Graphics.TOPGraphics.LEFT); }