test.java
来自「java的23中设计模式的代码实现」· Java 代码 · 共 22 行
JAVA
22 行
/**
* A test client
*/
public class Test {
public static void main(String[] args) {
int lineCount = 4;
int lineWidth = 12;
Context myContext = new Context();
StrategyA strategyA = new StrategyA();
StrategyB strategyB = new StrategyB();
String s = "This is a test string ! This is a test string ! This is a test string ! This is a test string ! This is a test string ! This is a test string !";
myContext.setText(s);
myContext.setLineWidth(lineWidth);
myContext.setStrategy(strategyA);
myContext.drawText();
myContext.setLineCount(lineCount);
myContext.setStrategy(strategyB);
myContext.drawText();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?