java14章总结
圖形:
1、直線
new Line2D.Double(double x1,double1 y1,double x2,double y2);
2、矩形
new Rectangle2D.Double(double x,double y,double w,double h);
3、圓角矩形
new RoundRectangle2D.Double(double x,double y,double w,double h,double arcw,double arch);
4、橢圓
new Ellipse2D.Double(double x,double y,double w, doublw h);
5、圓弧
new Arc2D.Double(double x,double y,double w,double h,double start,double extent,int type);
6、繪制文本
Graphics2D 對象調用 drawString(String s,int x,int y)
7、二次曲線
QuadCurve2D.Double類
QuadCurve2D curve = new QuadCurve2D.Double(50,30,10,10,50,100);
CubicCurve2D curve = new CubicCurve2D.Double(50,30,10,10,100,100,50,100);
8、多邊形
Polygon polygon = new Polygon();
二、變換圖形
AffineTransform trans = new?AffineTransform();
translate(double a,double b);
scale(double a,double b);
rotate(double number,double x,double y);
圖形的布爾運算
Area a1 = new Area(T1);??
add(Area r);
intersect(Area r);
exclusiveOr(Area r);
subtract(Area r);
繪制鐘表:
?m = xcos(a)-ysin(a);
n = ycos(a)+xsin(a);
繪制圖像:
Icon icon = new ImageIcon("cat.jpeg");
button.setIcon(icon);
加載圖像:
Toolkit 對象 調用 getToolkit();返回對象的引用。
Image getImage(String fileName)返回一個image對象
繪制圖像
boolean drawImage(Image img,int x,int y,ImageObserver observer);
音頻:
AudioClip clip = Applet.newAudioClip(url);
clip.play();? loop();循環 stop();
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
?
總結
- 上一篇: java第十三章总结
- 下一篇: 优秀程序员必备素质——快速调试