Adapt适配器
Posted 岑忠满
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Adapt适配器相关的知识,希望对你有一定的参考价值。
为接口提供所有的空实现,让使用者仅仅覆盖需要的部分;
本思想肯定有问题,慢慢考究
frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { // TODO Auto-generated method stub super.windowClosing(e); } });
Window是一个接口,拥有众多方法等等待实现,如关闭,打开,最小化。。。。
WindowAdapter()是一个适配器,提供了所有Window方法的空实现,在不覆盖时,什么也不做
public abstract class WindowAdapter implements WindowListener, WindowStateListener, WindowFocusListener { public void windowOpened(WindowEvent e) {} public void windowClosing(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowActivated(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} public void windowStateChanged(WindowEvent e) {} public void windowGainedFocus(WindowEvent e) {} public void windowLostFocus(WindowEvent e) {} }
以上是关于Adapt适配器的主要内容,如果未能解决你的问题,请参考以下文章