-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVisulaizeLabel.java
122 lines (118 loc) · 5.01 KB
/
VisulaizeLabel.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/** Author: Shikhar K Gupta, Foram Joshi
* Project: DNA Pen
* Mentor: Prof. Manish K Gupta
*/
public class VisulaizeLabel {
public static int xCord;
public static int yCord;
public static int zCord;
public static String brickType;
public static JLabel picLabel;
public static boolean isSelected=true;
public void setLocation(int x, int y, int z){
xCord=x;
yCord=y;
zCord=z;
}
public void setType(String type){
brickType=type;
}
public JLabel getShape(){
if(brickType.equals("North")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/north.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,30,225);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("South")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/south.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,30,225);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("East")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/east.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,225,30);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("West")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/west.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,225,30);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("WestHalf")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/west_half.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,35,30);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("NorthHalf")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/north_half.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,30,30);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("SouthHalf")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/south_half.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,30,29);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("EastHalf")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/east_half.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,35,29);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
if(brickType.equals("Bond")){
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File("Brick_Images/bond.png"));
picLabel = new JLabel(new ImageIcon(myPicture));
picLabel.setBounds(xCord,yCord,23,20);
} catch (IOException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
return picLabel;
}
}