文件名称:97
-
所属分类:
- 标签属性:
- 上传时间:2014-03-14
-
文件大小:9.81kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
编程思路:首先,本练习因为要制作抓不住的方块的实例,所以首先要制作界面中的方块,先通过Graphics类的对象函数g.setColor(Color.red)设置方块的颜色为红色,然后通过语句g.drawRect(0, 0, size().width - 1, size().height - 1)和g.drawRect(mx, my, (size().width/10) - 1, (size().height/10) - 1)绘制出两个矩形,这样就完成了方块的制作。然后,为了实现“抓不住方块”的效果,所以要响应鼠标事件,通过函数public boolean mouseDown(java.awt.Event evt, int x, int y响应按下鼠标的动作,通过光标位置的判断来避免鼠标抓到界面中的方块。-Programming ideas: first, to make this exercise because the instance box not catch, so first of all to make the interface box, first set the box through the Graphics class object function g.setColor (Color.red) color is red, then By statement g.drawRect (0, 0, size () width-. 1, size () height-. 1) and g.drawRect (mx, my, (size () .width/10)- 1, (size ( ) .height/10)- 1) draw two rectangles, thus completing the box production. Then, in order to achieve " catch box" effect, so to respond to mouse events, through the function public boolean mouseDown (java.awt.Event evt, int x, int y in response to pressing the mouse moves the cursor position to judge by Avoid mouse caught in the interface box.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
练习97抓不住的方块/MouseTrack.class
练习97抓不住的方块/MouseTrack.html
练习97抓不住的方块/MouseTrack.java
练习97抓不住的方块/_desktop.ini
练习97抓不住的方块/练习96抓不住的方块.doc
练习97抓不住的方块
练习97抓不住的方块/MouseTrack.html
练习97抓不住的方块/MouseTrack.java
练习97抓不住的方块/_desktop.ini
练习97抓不住的方块/练习96抓不住的方块.doc
练习97抓不住的方块
1999-2046 搜珍网 All Rights Reserved.
本站作为网络服务提供者,仅为网络服务对象提供信息存储空间,仅对用户上载内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
