-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptions.java
More file actions
74 lines (73 loc) · 1.48 KB
/
Copy pathOptions.java
File metadata and controls
74 lines (73 loc) · 1.48 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
/*Options.java
* @version 1.0
* @author Trotyl
* @since 2019.Dec.16
* A class that manages the options*/
public class Options {
String op1;
String op2;
String op3;
int opNum;
boolean haveO;
Font f = new Font("Couier", Font.PLAIN, 25);
Image box=new ImageIcon("image/option.png").getImage();
int answer;
Options(String op1){
this.op1=op1;
opNum=1;
answer=0;
haveO=true;
}
Options(String op1,String op2){
this.op1=op1;
this.op2=op2;
opNum=2;
haveO=true;
}
Options(String op1,String op2,String op3){
this.op1=op1;
this.op2=op2;
this.op3=op3;
opNum=3;
haveO=false;
}
public void open() {
haveO=true;
}
public void close() {
haveO=false;
}
public boolean isOn() {
return haveO;
}
public int getNum() {
return opNum;
}
public void setAns(int a) {
answer=a;
}
public int getAns() {
return answer;
}
public void draw(Graphics g) {
if(opNum>=1) {
g.drawImage(box,0,-50,null);
g.setFont(f);
g.drawString(op1, 400,180);
}
if(opNum>=2) {
g.drawImage(box,0,100,null);
g.setFont(f);
g.drawString(op2, 400,330);
}
if(opNum>=3) {
g.drawImage(box,0,250,null);
g.setFont(f);
g.drawString(op3, 400,480);
}
}
}