图形:
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();