import java.awt.*;
import java.awt.geom.*;
public class DrawingTest extends Frame {
Shape shapes[] = new Shape[4];
public DrawingTest (String title) {
super(title);
setSize(500, 400);
drawShapes();
add("Center", new MyCanvas());
}
public static void main(String args[]) {
DrawingTest app = new DrawingTest("Drawing test");
app.show();
}
void drawShapes () {
shapes[0] = new Rectangle2D.Double(12.0,12.0, 98.0, 120.0);
shapes[1] = new Ellipse2D.Double(150.0, 150.0,90.0,30.0);
shapes[2] = new RoundRectangle2D.Double(200.0, 25,
235.0, 250.0, 50.0, 100.0);
GeneralPath path = new GeneralPath(new Line2D.Double(100.0,
350.0, 150.0, 300.0));
path.append(new Line2D.Double(150.0, 300.0,
200.0, 350.0), true);
path.append(new Line2D.Double(200.0, 350.0,
250.0, 300.0), true);
path.append(new Line2D.Double(250.0, 300.0,
300.0, 350.0), true);
shapes[3] = path;
}
class MyCanvas extends Canvas {
public void paint(Graphics graphics) {
Graphics2D gr = (Graphics2D) graphics;
for (int i=0; i<4; i++)
gr.draw(shapes[i]);
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
21天学通C 光盘代码 (406个子文件)
hello.aspx 508B
week2.c 7KB
week3.c 6KB
linklist.c 6KB
week1.c 5KB
Coder.c 3KB
ptrsort.c 2KB
menu2c.c 2KB
menu2.c 2KB
printf.c 2KB
fseek.c 2KB
count_ch.c 2KB
sort.c 2KB
ListD03.c 1KB
menu.c 1KB
times.c 1KB
linkdemo.c 1KB
scanit.c 1KB
ptrmulti.c 1KB
getint.c 1KB
scanf.c 1KB
ftell.c 1KB
struct.c 1KB
strsort.c 1KB
copyit.c 1KB
typecast.c 1KB
sort.c 1KB
direct.c 1KB
find_nbr.c 1KB
union2.c 1KB
ListD06.c 1KB
malloc.c 1KB
escape.c 1KB
free.c 1KB
fopen.c 1KB
random.c 1KB
ListD05.c 1KB
fprintf.c 1KB
ListD04.c 1KB
sizeof.c 1KB
ListD07.c 1KB
passptr.c 1018B
mem.c 1011B
print_it.c 992B
print_it2.c 984B
vary.c 980B
ListD01.c 972B
ListD02.c 971B
mortgage.c 967B
passing2.c 954B
fallthru.c 933B
func.c 929B
memalloc.c 920B
strucarr.c 912B
array.c 911B
const.c 910B
arraysize.c 909B
access.c 907B
Ex08_08.c 893B
seconds.c 861B
list_it.c 860B
switch2.c 841B
ptr2.c 840B
passing.c 835B
cont.c 828B
realloc.c 802B
grades.c 788B
new_time.c 778B
asize.c 773B
Ex10_05.c 764B
test.c 762B
strcpy.c 760B
union.c 755B
ptr_math.c 739B
seconds.c 736B
args.c 708B
do.c 693B
clearing.c 659B
recurse.c 652B
upper2.c 649B
multiply.c 644B
feof.c 632B
whiles.c 628B
return.c 620B
putchar2.c 620B
strchr.c 619B
Ex09_07.c 619B
List0406.c 611B
List0502.c 608B
strcmp.c 593B
ptr.c 575B
gotoIt.c 574B
expenses.c 573B
strcspn.c 570B
switch.c 570B
nums.c 567B
Ex09_09.c 567B
List0404.c 565B
clear.c 558B
strspn.c 555B
共 406 条
- 1
- 2
- 3
- 4
- 5
资源评论
- 123123fsfsfsafsdf2013-10-24非常的实用
wondee
- 粉丝: 4
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功