-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubConcreteMediator.java
More file actions
32 lines (29 loc) · 1 KB
/
SubConcreteMediator.java
File metadata and controls
32 lines (29 loc) · 1 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
package designpattern.behavioral_pattern.mediator.v2;
import designpattern.behavioral_pattern.mediator.v1.Component;
import designpattern.behavioral_pattern.mediator.v1.ConcreteMediator;
public class SubConcreteMediator extends ConcreteMediator {
//增加对Label对象的引用
public Label label;
public void componentChanged(Component c) {
//单击按钮
if (c == addButton) {
System.out.println("--单击增加按钮--");
list.update();
cb.update();
userNameTextBox.update();
label.update(); //文本标签更新
}
//从列表框选择客户
else if (c == list) {
System.out.println("--从列表框选择客户--");
cb.select();
userNameTextBox.setText();
}
//从组合框选择客户
else if (c == cb) {
System.out.println("--从组合框选择客户--");
cb.select();
userNameTextBox.setText();
}
}
}