依赖于抽象不对了?
caoi 2006-09-20 12:19:38 UI Swing turorial online.
Related page:
http://java.sun.com/docs/books/tutorial/uiswing/layout/spring.html
source code:
http://java.sun.com/docs/books/tutorial/uiswing/layout/examples/SpringDemo2.java
My question is about this line:
SpringLayout layout = new SpringLayout();
As we know, class SpringLayout is implemented the interface LayoutManger, so this SpringLayout-to-LayoutManager is is-a relation. But when I replace it by:
LayoutManager layout = new SpringLayout();
Problem occurs, the IDE indicates that methods cannot be found.
Jeff Yan说过依赖于抽象的依赖反转原则DIP,这里怎么没有效果呢?我错哪里了?