?? mvc2ctrl.java
字號:
package com.sitinspring;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* 控制類
*
* @author sitinspring(junglesong@gmail.com)
*
* @date 2007-11-5
*/
public class Mvc2Ctrl {
private Mvc2View view;
private Mvc2Model model;
public Mvc2Ctrl() {
view = new Mvc2View();
model = new Mvc2Model();
handleEvents();
}
// 處理事件響應
private void handleEvents() {
addCloseLintener();
addButtonListener();
addButtonListener2();
}
// 窗體關閉事件相應
private void addCloseLintener() {
view.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Exit MVC2");
System.exit(0);
}
});
}
private void addButtonListener() {
view.getButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
view.getLabel().setText(model.getText());
}
});
}
private void addButtonListener2() {
view.getButton2().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
view.getLabel2().setText(model.getText2());
}
});
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -