-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpos.java
45 lines (45 loc) · 778 Bytes
/
pos.java
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
38
39
40
41
42
43
44
45
import java.awt.*;
import java.awt.event.*;
class demo extends Frame
{
TextField t1;
demo()
{
setVisible(true);
setSize(500,500);
setLocation(500,500);
setLayout(new FlowLayout());
t1=new TextField(20);
add(t1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.out.println("Wnidow Closing...");
dispose();
}
}
);
addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent we)
{
System.out.println("Window Closed");
dispose();
}
}
);
addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent me)
{
t1.setText("X = "+me.getX()+" Y = "+me.getY());
}
}
);
}
public static void main(String ar[])
{
new demo();
}
}