-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContentTile.java
More file actions
50 lines (32 loc) · 880 Bytes
/
ContentTile.java
File metadata and controls
50 lines (32 loc) · 880 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
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.awt.Color;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ContentTile
{
public Color color;
public Image image = null;
public int x, y;
public ContentTile(int x, int y)
{
this.x = x;
this.y = y;
color = new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255));
}
public ContentTile(int x, int y, String imgPath)
{
this.x = x;
this.y = y;
color = new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255));
try
{
image = ImageIO.read(new File(imgPath));
}
catch(IOException ie)
{
System.out.println("DID NOT WORK");
image = null;
}
}
}