⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listbridge.java

📁 《java设计模式》一书的源码
💻 JAVA
字号:
import java.awt.*;
import java.util.*;
import javax.swing.*;

//this is the Implementor class
//that decides which class to return
public class listBridge extends Bridger {
   
  public static final int LIST=1, TABLE=2, TREE=3;
  protected visList list;

  public listBridge(int type) {
     setLayout(new BorderLayout());
      switch (type) {
      case LIST:
         list =  new productList();
         add("Center", (JComponent)list);
         break;
      case TABLE:
         list = new productTable();
         add("Center", (JComponent)list);
          break;
      case TREE:
         list = new productTree();
         add("Center", (JComponent)list);
          break;
      default:
         list = null;
      }
      
   }  
  public void addData(Vector v) {
     for(int i=0; i<v.size(); i++) {
        String s = (String)v.elementAt (i);
        list.addLine (s);
     }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -