Once
up a time, when you see a mouse, the first thing you would do is definitely
scream or jump on the desk or run away. Today, the mouse actually jump on your
desk: it also has a long tail and a round body, but it is one of the most
useful items on your desk now.
To
better understand the device that we use to write program, it is useful to learn
how every part of the computer works and what they can do that will help us
have a better use of it.
A mouse is something you push along your
desktop to make a cursor move on your screen. So its job is to figure out how
much you're moving your hand and in
which direction. There are two main kinds of mice and they do this job in two
different ways, either using a rolling rubber ball (in a ball-type mouse) or by
bouncing a light off your desk (in an optical mouse). Nowadays, most of
the computer are equipped with an optical mouse because it is more precise and
more durable.
An optimal mouse has a LED
light that bounces light off that surface onto a sensor called complementary metal-oxide semiconductor(CMOS). The sensor sends each image to
a digital signal processor (DSP) for analysis. It is able to detect patterns in
the images and see how those patterns change compared to the previous ones.
Based on the change in patterns over a sequence of images, the DSP determines
how far the mouse has moved and sends the corresponding coordinates to the computer.
As
for how a mouse can be useful in computer science during programming, it allows
us to gain more information and command from the users. All what we have
covered in class is to make programs that relate to "command line" or
"scanner" that input numbers or strings. Mouse can be another great
source of command that allows us to realize more different ways of getting
information.
Java
has a lot of different
operations related to mouse movement. There is a class "MouseEvent"
that traces a mouse action occurred in a
component. And there are a lot of different types that we can use to
improve our program. As we learn more and more into computer science and java,
mouse is going to be a useful tool for us to program.
Reference:
1.http://www.explainthatstuff.com/computermouse.html
2.http://computer.howstuffworks.com/question631.htm
没有评论:
发表评论