文件名称:95
介绍说明--下载内容均来自于网络,请自行研究使用
编程思路:本练习因为要实现华容道游戏中人物的构造,所以首先要生成表示人物的矩形块,这是通过语句Rectangle rect=null实例化Rectangle类,然后在People类的构造函数里通过语句rect=new Rectangle(x,y,w,h)实现有戏中人物的构造。然后因为要实现人机交互的效果,所以要响应当前光标的焦点事件,通过public void focusGained(FocusEvent e)函数得到焦点,通过public void focusLost(FocusEvent e)函数失去当前焦点,参数是焦点事件类FocusEvent的对象e.最后,因为要配合焦点的移动来设置颜色,所以用到了颜色类Color,当得到焦点的时候,通过语句setBackground(Color.red)将背景色设置为红色,当失去焦点的时候,通过语句setBackground(Color.orange)将背景色设置为橙色-Programming ideas: this exercise because Huarong game characters to achieve the structure, so the first character to generate said rectangular block, which is by the statement Rectangle rect = null instantiated Rectangle class, then class' s constructor People rect by the statement = new Rectangle (x, y, w, h) to achieve the structure Me characters. Then because to achieve the effect of human-computer interaction, so to respond to the current cursor focus events, through public void focusGained (FocusEvent e) function to get the focus, the focus of the current function lost through public void focusLost (FocusEvent e), the parameter is the focus of the event class FocusEvent The object e. Finally, because the focus moves to tie to set the color, so use a color class Color, when I get the focus through the statement setBackground (Color.red) set the background color to red, when losing focus, By statement setBackground (Color.orange) set the background color to orange
(系统自动生成,下载前可以参看下载内容)
下载文件列表
练习95华容道(一)\HuaRongRoad.class
..................\HuaRongRoad.html
..................\HuaRongRoad.java
..................\People.class
..................\_desktop.ini
..................\练习95华容道(一).doc
练习95华容道(一)