- 6
- 0
- 约5.28千字
- 约 29页
- 2015-08-15 发布于湖北
- 举报
Java与图形.ppt
GUI编程 Java与图形 Java.awt包中的Graphics类有很多处理图形的方法,供该类创建的对象使用 主要内容 显示字符串与字符数组 画直线、矩形、圆环 画带颜色的图形 画椭圆、圆弧 画多边形 建立字体 使用clearRect方法 显示字符串与字符数组 使用drawString方法在屏幕上显示串对象: drawString(String s,int x,int y) 使用Graphics类的drawChar方法显示字符数组: drawChar(char data[],int offset,int length,int x,int y) 画直线 使用Graphics类的drawLine方法: drawLine(int x1,int y1,int x2,int y2) 画矩形 drawRect方法: drawRect(int x,int y,int width,int height) x,y指定矩形左上角的位置 width,height指定矩形的大小(单位:像素) 画矩形 使用drawRoundRect方法画圆角矩形: drawRoundRect(int x,int y,int width,int height,int arcWidth,int arcHeight) arcWidth, arcHeight指定矩形圆角的尺寸 画圆环 使用drawRoundRect方法也可画圆
原创力文档

文档评论(0)