-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFBSettingWindow.java
More file actions
42 lines (33 loc) · 1.08 KB
/
FBSettingWindow.java
File metadata and controls
42 lines (33 loc) · 1.08 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
package designpattern.behavioral_pattern.command.v1;
import java.util.ArrayList;
import java.util.List;
//功能键设置窗口类
public class FBSettingWindow {
private String title; //窗口标题
//定义一个ArrayList来存储所有功能键
private List<FunctionButton> functionButtons = new ArrayList<>();
public FBSettingWindow(String title) {
this.title = title;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public void addFunctionButton(FunctionButton fb) {
functionButtons.add(fb);
}
public void removeFunctionButton(FunctionButton fb) {
functionButtons.remove(fb);
}
//显示窗口及功能键
public void display() {
System.out.println("显示窗口:" + this.title);
System.out.println("显示功能键:");
for (Object obj : functionButtons) {
System.out.println(((FunctionButton) obj).getName());
}
System.out.println("------------------------------");
}
}