void open();
void close();
void bigWindow();
void smallWindow();
}
abstract class AbstractAdapter implements Window {
// 通过实现接口 重写接口中的方法
@Override
public void bigWindow() {
// TODO Auto-generated method stub
}
@Override
public void close() {
// TODO Auto-generated method stub
}
@Override
public void open() {
// TODO Auto-generated method stub
}
@Override
public void smallWindow() {
// TODO Auto-generated method stub
}
}
class Adapter_MoBan extends AbstractAdapter {
// 在重写AbstractDemo中适配所需要的方法
@Override
public void close() {
// TODO Auto-generated method stub
System.out.println("关闭窗口");
}
@Override
public void open() {
// TODO Auto-generated method stub
System.out.print("打开窗口");
}
}
public class AdapterDemo {
/**
* 适配器模式---图形界面适配
*/
public static void main(String[] args) {
Window window = new Adapter_MoBan();
window.close();
window.open();
}
}