Fill rectangle : Rectangle « J2ME « Java Tutorial

Fill rectangle
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;

public class FillRectGraphicsMIDlet extends MIDlet {
  private Display display;
  protected void startApp() {
    Canvas canvas = new LineCanvas();
    display = Display.getDisplay(this);
  protected void pauseApp() {
  protected void destroyApp(boolean unconditional) {

class LineCanvas extends Canvas {
  public void paint(Graphics g) {
    int width = getWidth();
    int height = getHeight();
    g.fillRect(0, 0, width, height);  

31.33.1.Fill rectangleFill rectangle
31.33.2.Draw rectangleDraw rectangle
31.33.3.Fill Round RectangleFill Round Rectangle
31.33.4.Fill a rectangle, and a round rectangleFill a rectangle, and a round rectangle