JavaCh 15 Graphics 2011 04 01 Outline Graphical
- Slides: 13
Java@Ch 15. Graphics 2011. 04. 01
Outline • • Graphical Coodinate Systems The Graphics Class Drawing Strings, Lines, Rectangles, and Ovals Drawing Polygons and Polylines [Sample code] Test. Paint. Component. java Draw. Poly. Line. java
Graphical Coodinate Systems (0, 0) at the upper-left corner
The Graphics Class Java. awt. Graphics +set. Color(color: Color): void +set. Font(font: Font): void +draw. String(s: String , x: int , y: int): void +draw. Line(x 1, : int , y 1: int , x 2: int , y 2: int): void +draw. Rect(x: int , y: int , w: int , h: int): void +fill. Rect(x: int , y: int , w: int , h: int): void +draw. Round. Rect(x: int , y: int , w: int , h: int , aw: int , ah: int): void +fill. Round. Rect(x: int , y: int , w: int , h: int , aw: int , ah: int): void +draw 3 DRect(x: int , y: int , w: int , h: int , raised: boolean): void +fill 3 DRect(x: int , y: int , w: int , h: int , raised: boolean): void 課本 P. 523
Drawing Strings, Lines, Rectangles, and Ovals draw. String(String s, int x, int y) method draw. Line(int x 1, int y 1, int x 2, int y 2) method
程式範例: Test. Paint. Component. java 課本 P. 524 Liting 15. 1
draw. Rec(intx, int y, int w, int h) method fill. Rec(intx, int y, int w, int h) method
draw. Round. Rect(x, y, w, h, aw, ah) method draw. Oval(x, y , w, h) method
Drawing Arcs draw. Arc(int x, int y, int w, int h, int start. Angle, int arc. Angle) fill. Arc(int x, int y, int w, int h, int start. Angle, int arc. Angle)
範例練習: Draw. Arcs. java 課本 P. 530 Liting 15. 4
程式練習: 1. 用g. draw. Oval() 畫臉 2. fill. Oval() 畫眼睛 3. set. Color() 設定畫筆顏色 4. draw. Arc() 畫嘴巴 (需import java. awt. Color)
Drawing Polygons and Polylines Java. awt. Polygon +xpoints: int [] +ypoints: int [] +nponits: int [] +Polygon() +Polygon(xpoints: int [] , ypoints: int [] , npoints: int []) +add. Points(x: int, y: int) 課本 P. 532
程式範例: Draw. Poly. Line. java
- Javach
- Input techniques in computer graphics
- Graphics monitors and workstations in computer graphics
- Introduction to computer graphics - ppt
- Sentence outline
- Is a graphical representation of the ground drawn to scale.
- Graphical addition of vectors
- Graphical symbols for use on equipment
- Graphical user interface design principles
- Rajiv manglani
- User interface characteristics
- Graphical user interface in data structures
- Ruby gui programming
- Paradigms of interaction in hci