全文预览

Java程序设计实验报告2(弹球游戏)[1]1

上传者:科技星球 |  格式:doc  |  页数:12 |  大小:101KB

文档介绍
upThread.get(i).dx;}if(yNow>(getHeight()-23)||yNow<0){//碰到上下边界;groupThread.get(i).dy=-groupThread.get(i).dy;}groupThread.get(i).setxNow(xNow+groupThread.get(i).getdx());groupThread.get(i).setyNow(yNow+groupThread.get(i).getdy());}}if(isMouse){g.drawImage(newImageIcon("boll.gif").getImage(),mxNow,myNow,40,40,this);}}//endpaint();C:(1)publicvoidmousePressed(MouseEvente){//单击启动鼠标事件;if(e.getButton()==MouseEvent.BUTTON1){if(isMouseThread){//鼠标线程是否活着;mouse.stop();isMouseThread=false;}if(!isTime){copy.schedule(newtask(),0,1000);//启动定时器;isTime=true;}if(!isGroupThread){for(inti=0;i<n;++i){Threadmy=newThread(groupThread.get(i));my.start();//启动游戏,启动小球线程;}isGroupThread=true;}mxNow=e.getX();myNow=e.getY();isMouse=true;}//endif(e.getButton()==MouseEvent.BUTTON1);}(2)publicvoidmouseReleased(MouseEvente){

收藏

分享

举报
下载此文档