forked from igortereshchenko/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunner.java
More file actions
58 lines (38 loc) · 1.26 KB
/
Runner.java
File metadata and controls
58 lines (38 loc) · 1.26 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
package LessonInterface;
/**
* Created by student on 19.03.2018.
*/
public class Runner {
public static void main(String[] arg){
Button button = new Button(new ButtonClickHandler());
Button coolButton = new Button(new CoolButtonClickHandler());
System.out.println("ButtonClickHandler and CoolButtonClickHandler");
button.Click();
coolButton.Click();
System.out.println("\n\nanomimus IEventHandler");
Button anomimusButton = new Button(new IEventHandler() {
public void execute() {
System.out.println("Anonymus button pressed");
}
});
anomimusButton.Click();
System.out.println("\n\nanomimus IEventHandler with fields");
Button tvButton = new Button(new IEventHandler() {
boolean on = false;
public void execute() {
if (on){
System.out.println("TV turn OFF");
on=false;
}else{
System.out.println("TV turn ON");
on=true;
}
}
});
tvButton.Click();
tvButton.Click();
tvButton.Click();
tvButton.Click();
tvButton.Click();
}
}