JScrollPane jsp = new JScrollPane(plugInsList); jsp.setMinimumSize(new Dimension(50, 50));
JScrollPane jsp = new JScrollPane(plugInsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); jsp.setPreferredSize(new Dimension(400, 100));
  private void displayPlugins(String agentName) {    ComponentData societyComponentData = experiment.getSocietyComponentData();    if (societyComponentData == null) {      if(log.isWarnEnabled()) {        log.warn("ConsoleInternalFrame: Need to save experiment");      }      return;    }    ComponentData[] children = societyComponentData.getChildren();    ComponentData nodeComponentData = null;    for (int i = 0; i < children.length; i++) {      if (children[i].getType().equals(ComponentData.HOST)) {        ComponentData[] nodes = children[i].getChildren();        for (int j = 0; j < nodes.length; j++) {          if (nodes[j].getName().equals(node.getShortName())) {            nodeComponentData = nodes[j];            break;          }        }      }    }    //  If couldn't find the node in the ComponentData, give up    if (nodeComponentData == null)      return;    ComponentData agentComponentData = null;    // The "agent" might be a NodeAgent, in which case this is the right spot.    if (agentName.equals(nodeComponentData.getName())) {      agentComponentData = nodeComponentData;    } else {      // OK. Find the sub-Agent with the right name      ComponentData[] agents = nodeComponentData.getChildren();      for (int i = 0; i < agents.length; i++) {	if (agents[i] instanceof AgentComponentData &&	    agents[i].getName().equals(agentName)) {	  agentComponentData = agents[i];	  break;	}      }    }        // If couldn't find the Agent in the ComponentData for the node, give up    if (agentComponentData == null)      return;    // Loop through the children    ComponentData[] agentChildren = agentComponentData.getChildren();    ArrayList entries = new ArrayList(agentChildren.length);    for (int i = 0; i < agentChildren.length; i++) {      // If this Agent is a NodeAgent, ignore its Agent children.      if (agentChildren[i].getType().equals(ComponentData.AGENT))	continue;      // FIXME: This should use same code as ExperimentINIWriter if possible      StringBuffer sb = new StringBuffer();      if (agentChildren[i].getType().equals(ComponentData.AGENTBINDER)) {	sb.append("Node.AgentManager.Agent.PluginManager.Binder");      } else if (agentChildren[i].getType().equals(ComponentData.NODEBINDER)) {	sb.append("Node.AgentManager.Binder");      } else {	sb.append(agentChildren[i].getType());      }      if(ComponentDescription.parsePriority(agentChildren[i].getPriority()) != 	 ComponentDescription.PRIORITY_COMPONENT) {	sb.append("(" + agentChildren[i].getPriority() + ")");      }      sb.append(" = ");      sb.append(agentChildren[i].getClassName());      if (agentChildren[i].parameterCount() != 0) {        sb.append("(");        Object[] params = agentChildren[i].getParameters();        sb.append(params[0].toString());        for (int j = 1; j < agentChildren[i].parameterCount(); j++) {          sb.append(",");          sb.append(params[j].toString());        }        sb.append(")");      }      entries.add(sb.toString());    }    JList plugInsList = new JList(entries.toArray());    JScrollPane jsp = new JScrollPane(plugInsList);    jsp.setMinimumSize(new Dimension(50, 50));    // FIXME: Don't force entire content to fit horizontally    // And add a horizontal scroll-bar if necessary    // Bug 1525    JPanel agentInfoPanel = new JPanel();    agentInfoPanel.setLayout(new GridBagLayout());    plugInsList.setBackground(agentInfoPanel.getBackground());    int x = 0;    int y = 0;    agentInfoPanel.add(new JLabel("SubComponents:"),                   new GridBagConstraints(x++, y, 1, 1, 0.0, 0.0,                                          GridBagConstraints.WEST,                                          GridBagConstraints.NONE,                                          new Insets(10, 0, 5, 5),                                          0, 0));    agentInfoPanel.add(jsp,                   new GridBagConstraints(x, y++, 1, 1, 1.0, 0.0,                                          GridBagConstraints.WEST,                                          GridBagConstraints.HORIZONTAL,                                          new Insets(0, 0, 5, 0),                                          0, 0));    JOptionPane.showMessageDialog(this, agentInfoPanel,                                   "Information: " + agentName,                                  JOptionPane.PLAIN_MESSAGE);  }