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();

                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值