The rectangular shape is definitely an part of the canvas described through 4 corners , as being a rectangular shape that you could pull utilizing document as well as pen. You define a rectangle’s dimensions by identifying coordinates for the upper-left corner and the lower-right corner. Four types of rectangles can be drawn on a canvas.
They are a good layed out rectangular shape, stuffed rectangular shape, layed out rectangular shape along with curved edges, along with a stuffed rectangular shape along with rounded corners.
An outlined rectangle is one where only line segments connecting the corners are drawn. The inside of the rectangle remains the same color as the outside of the rectangle.
FillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)Returns FillRoundRect by rounded rectangle
example code :import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* @author 1code
*/
public class fill extends MIDlet {
private Write canvas;
Display display;
public void startApp() {
display = Display.getDisplay(this);
canvas = new Write(this);
display.setCurrent(canvas);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
class Write extends Canvas {
fill midlet;
private final fill This;
public Write(fill This) {
this.midlet= midlet;
this.This = This;
}
protected void paint(Graphics drwa) {
drwa.setColor(255,255,255); //the background
drwa.fillRect(0,0,getWidth(),getHeight()); //fill backgrounddrwa.setColor(0,0,255);
drwa.fillRoundRect(getWidth()/5, getHeight()/4, getWidth()/6, getHeight()/2, 7, 10);
drwa.setColor(254,0,255);
drwa.fillRoundRect(getWidth()/2, getHeight()/4, getWidth()/6, getHeight()/4, 180, 360);
}

6:00 PM
1code
Posted in:
0 comments:
Post a Comment