private void switchActiveTable() {
   if (tables.get(Cytoscape.getCurrentNetwork()) != currentTable) {
     currentTable.getSelectionModel().removeListSelectionListener(PathwayFilterPanel.this);
     scrollPane.getViewport().setView(null);
     currentTable = tables.get(Cytoscape.getCurrentNetwork());
     if (currentTable == null) {
       currentTable = new ExtendedJTable();
       tables.put(Cytoscape.getCurrentNetwork(), currentTable);
       ((ExtendedTableModel) currentTable.getModel()).addColumn("Pathways");
       currentTable.getRowSorter().toggleSortOrder(0);
       currentModel = (ExtendedTableModel) currentTable.getModel();
       refreshPathwayListForCurrentNetwork();
     }
     currentModel = (ExtendedTableModel) currentTable.getModel();
     scrollPane.getViewport().setView(currentTable);
     currentTable.getSelectionModel().addListSelectionListener(PathwayFilterPanel.this);
   }
   applySelectionToNetwork();
 }
  private void createControls() {
    buttonPanel = new JPanel();

    selectAll = new JButton("Select All Pathways");
    selectAll.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectAll();
          }
        });
    buttonPanel.add(selectAll);

    deselectAll = new JButton("Deselect All Pathways");
    deselectAll.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            deselectAll();
          }
        });
    buttonPanel.add(deselectAll);

    createSubnetwork = new JButton("Create Subnetwork");
    createSubnetwork.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            buildSubnetwork();
          }
        });
    buttonPanel.add(createSubnetwork);

    reapplySelection = new JButton("Reapply Selection");
    reapplySelection.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            applySelectionToNetwork();
          }
        });
    buttonPanel.add(reapplySelection);

    close = new JButton("Close");
    close.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            close();
          }
        });
    buttonPanel.add(close);

    add(buttonPanel, BorderLayout.NORTH);
    tables = new HashMap<CyNetwork, ExtendedJTable>();
    currentTable = new ExtendedJTable();
    tables.put(Cytoscape.getCurrentNetwork(), currentTable);
    currentTable.getSelectionModel().addListSelectionListener(this);
    currentModel = (ExtendedTableModel) currentTable.getModel();
    currentModel.addColumn("Pathways");
    currentTable.getRowSorter().toggleSortOrder(0);
    scrollPane = new JScrollPane(currentTable);
    refreshPathwayListForCurrentNetwork();

    add(scrollPane, BorderLayout.CENTER);
    addComponentListener(this);
  }