?? animationpainter.java
字號:
package graphicAnimation;
import javax.swing.JComponent;
import animationController.AnimationController;
public abstract class AnimationPainter {
protected JComponent parent = null; // 所有顯示空間的父構件,通常是主框架的內容頁面
protected JComponent[] toBlock = null;
protected AnimationDriver animationDriver = null; // 當兩個區域的動畫展示需要同步進行時所使用的演示管理器
protected AnimationController controller = null;
public AnimationPainter(JComponent parent, JComponent[] toBlock, AnimationController controller) {
this.parent = parent;
this.toBlock = toBlock;
this.controller = controller;
}
public void initialize() {
// 清空 parent 中原有的構件
parent.removeAll();
// 使得需要阻塞的GUI構件不可使用
for (int i = 0; i < toBlock.length; i++) toBlock[i].setEnabled(false);
// 創建動畫驅動器
animationDriver = new AnimationDriver();
createAnimator();
createAnimationArea();
connectAnimatorAndArea();
useControllerParameter();
// 使得新加入的構件在構件容器 parent 中真正可見
parent.validate();
}
protected abstract void createAnimator();
protected abstract void createAnimationArea();
protected abstract void connectAnimatorAndArea();
protected abstract void useControllerParameter();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -