Numeric Color Component Values
Sumber: Sams Teach Yourself: Wireless Java With J2ME in 21 Days
LinesDipakai untuk menggambar garis.
Syntax:drawLine(int x1, int y1, int x2, int y2)dimana x1, y1 adalah starting point dan x2, y2 adalah ending point.
Contoh:
public void paint(Graphics g) {g.drawLine(5, 10, 15, 55);}
Dipakai untuk menggambar persegi atau persegi panjang.Rectangles
Syntax: drawRect(int x, int y, int width, int height)
Contoh:
public void paint(Graphics g) {g.drawRect(5, 10, 15, 55);}
Dipakai untuk menggambar sudut.Arcs
Syntax: drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Contoh:
public void paint(Graphics g) {g.drawArc(5, 10, 150, 75, 95, 115);}
Drawing TextDipakai untuk menambahkan teks.
Syntax: setFont(Font font)
Font getFont(int face, int style, int size)
The font face must be one of the following values: FACE_SYSTEM, FACE_MONOSPACE, or FACE_PROPORTIONAL.
The style of font must be one of the constants I mentioned earlier: STYLE_PLAIN or a combinationof STYLE_BOLD, STYLE_ITALIC, and STYLE_UNDERLINED. The font size is specifiedas one of the following predefined constants: SIZE_SMALL, SIZE_MEDIUM, or SIZE_LARGE.
Contoh:
Font myFont = Font.getFont(Font.MONOSPACE, Font.LARGE, Font.BOLD | Font.UNDERLINED);
drawString(String str, int x, int y, int anchor)
An anchor point is associated with a horizontal constant and avertical constant, each of which determines the horizontal and vertical positioning of thetext with respect to the anchor point. The horizontal constants used to describe an anchorpoint are LEFT, HCENTER, and RIGHT. One of these constants is combined with a verticalconstant to fully describe an anchor point. The vertical constants are TOP, BASELINE, andBOTTOM.
Contoh:
g.drawString(“Look up here!”, getWidth() / 2, 0, Graphics.HCENTER | Graphics.TOP);
Drawing ImagesDipakai untuk menambahkan image atau picture.
Contoh:public void paint(Graphics g) {
// Clear the display
g.setColor(255, 255, 255); // Whiteg.fillRect(0, 0, getWidth(), getHeight());
// Create and load the image
Image img = Image.createImage(“Bull.png”);
// Draw the image
g.drawImage(img, getWidth()/2, getHeight()/2,
Graphics.HCENTER|Graphics.VCENTER);}
Sumber: Sams Teach Yourself: Wireless Java With J2ME in 21 Days
CasinoDaddy - DrMCD
ReplyDeleteThis website is a gambling website 남양주 출장안마 operated 세종특별자치 출장샵 by Dr.MCD and operated 전주 출장샵 by the 포항 출장안마 Borgata Hotel Casino & Spa, Atlantic City. It provides information about casino License: 7/2021Location: 이천 출장샵 7.0 Rating: 7.1/10 · 1 review