Draw arc : Arc « J2ME « Java Tutorial






Draw arc
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;

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

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

        g.drawArc(0, 0, width/2, height/2, 0, 90);


  }
}








31.27.Arc
31.27.1.Draw arcDraw arc
31.27.2.Fill arcFill arc
31.27.3.Pie chartPie chart
31.27.4.Fill an arc, change new color and fill a rectangleFill an arc, change new color and fill a rectangle