-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmyIcon.java
More file actions
executable file
·51 lines (44 loc) · 1.09 KB
/
myIcon.java
File metadata and controls
executable file
·51 lines (44 loc) · 1.09 KB
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
46
47
48
49
50
51
/*
* myIcon.java
*
* Created on November 3, 2006, 3:19 PM
*/
/**
* @author Chen-Fu Liao
* Sr. Systems Engineer
* ITS Institute, ITS Laboratory
* Center For Transportation Studies
* University of Minnesota
* 200 Transportation and Safety Building
* 511 Washington Ave. SE
* Minneapolis, MN 55455
*/
import java.awt.*;
import java.applet.*;
import java.net.URL;
import java.io.*;
public class myIcon extends Panel {
private Image img = null ;
/** Creates a new instance of myIcon */
public myIcon(String filename) {
URL url = null;
url = getClass().getResource(filename+".png");
if (url==null) {
url = getClass().getResource(filename+".PNG");
}
img = Toolkit.getDefaultToolkit().getImage(url);
this.setBackground(new Color(200, 200, 200)) ;
}
public void paint(Graphics g)
{
g.drawImage(img, 5, 5, 37, 37, this) ;
}
public Dimension preferredSize()
{
return(new Dimension(37,37));
}
public boolean mouseDown(Event e, int x, int y)
{
return true ;
}
}