-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmDrag.java
More file actions
37 lines (37 loc) · 740 Bytes
/
mDrag.java
File metadata and controls
37 lines (37 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/* <Applet code = "mDrag" width = 500 height = 500>
* </Applet>
*/
public class mDrag extends Applet implements MouseMotionListener
{
int mousex;
int mousey;
String msg = " ";
public void init()
{
mousex = 0;
mousey = 0;
addMouseMotionListener(this);
}
public void mouseDragged(MouseEvent me)
{
mousex = me.getX();
mousey = me.getY();
msg = " * ";
showStatus("Mouse Dragged:" + mousex + "," + mousey);
repaint();
}
public void mouseMoved(MouseEvent me)
{
msg = " ";
mousex = me.getX();
mousey = me.getY();
showStatus("Mouse Moved:" + mousex + "," + mousey);
}
public void paint(Graphics g)
{
g.drawString(msg,mousex,mousey);
}
}