javax.swing.JComponent
java.awt.LayoutManager
涉及3个角色
策略架构:
public class Context {
private Strategy strategy; /** * 策略方法 */ public void contextStrategy () { strategy.strategyInterface(); } }//策略接口
public interface Strategy {
public void strategyInterface();
}//策略实现
public class ConcreteStrategyA implements Strategy {
/** * 策略方法 */ public void strategyInterface() { System.out.println("ConcreteStrategyA ..."); }}