progressPanel.add(trialProgressBar,
final JLabel trialTimeLabel = new JLabel("Trial: 00:00:00"); final JLabel experimentTimeLabel = new JLabel("Experiment: 00:00:00"); myNumberFormat = new DecimalFormat("00");   JPanel trialProgressPanel = createHorizontalPanel(false); if (!experiment.isInDatabase()) { trialProgressPanel.add(trialTimeLabel); trialProgressPanel.add(Box.createRigidArea(HGAP10)); progressPanel.add(trialProgressBar,
  private void setSocietyComponent(SocietyComponent cc) {    communitySupport = new ClientCommunityController();    runningNodes = new Hashtable();    oldNodes = new Hashtable();    nodeListeners = new Hashtable();    nodePanes = new Hashtable();    // top level menus    JMenu fileMenu = new JMenu(FILE_MENU);    fileMenu.setToolTipText("Exit this tool.");    JMenuItem exitMenuItem = new JMenuItem(EXIT_MENU_ITEM);    exitMenuItem.setToolTipText("Exit this tool.");    exitMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	exitMenuItem_actionPerformed(e);      }    });    fileMenu.add(exitMenuItem);    JMenu viewMenu = new JMenu(VIEW_MENU);    JMenuItem viewMenuItem = new JMenuItem(SHOW_LOG_MENU_ITEM);    viewMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {      }    });    viewMenuItem.setEnabled(false); // disabled cause of Swing error    viewMenu.add(viewMenuItem);    JMenuItem viewSizeMenuItem = new JMenuItem(SET_VIEW_SIZE_MENU_ITEM);    viewSizeMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        viewSizeMenuItem_actionPerformed();      }    });    viewMenu.add(viewSizeMenuItem);    viewMenu.addSeparator();    JMenuItem filterMenuItem = new JMenuItem(FILTER_MENU_ITEM);    filterMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        filterMenuItem_actionPerformed();      }    });    viewMenu.add(filterMenuItem);    JMenuItem formatMenuItem = new JMenuItem(FORMAT_MENU_ITEM);    formatMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        formatMenuItem_actionPerformed();      }    });    viewMenu.add(formatMenuItem);    JMenu notifyMenu = new JMenu(NOTIFY_MENU);    JMenuItem setNotifyMenuItem = new JMenuItem(SET_NOTIFY_MENU_ITEM);    setNotifyMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        setNotifyMenuItem_actionPerformed();      }    });    notifyMenu.add(setNotifyMenuItem);    JMenuItem viewNotifyMenuItem = new JMenuItem(VIEW_NOTIFY_MENU_ITEM);    viewNotifyMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        viewNotifyMenuItem_actionPerformed();      }    });    notifyMenu.add(viewNotifyMenuItem);    JMenuItem removeNotifyMenuItem = new JMenuItem(REMOVE_NOTIFY_MENU_ITEM);    removeNotifyMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        removeNotifyMenuItem_actionPerformed();      }    });    notifyMenu.add(removeNotifyMenuItem);    notifyMenu.addSeparator();    JMenuItem resetNotifyMenuItem = new JMenuItem(RESET_NOTIFY_MENU_ITEM);    resetNotifyMenuItem.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        resetNotifyMenuItem_actionPerformed();      }    });    notifyMenu.add(resetNotifyMenuItem);    JMenu helpMenu = new JMenu(HELP_MENU);    JMenuItem helpMenuItem = new JMenuItem(ABOUT_CONSOLE_ITEM);    helpMenuItem.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  URL help = (URL)this.getClass().getResource(HELP_DOC);	  if (help != null)	    Browser.setPage(help);	}      });    helpMenu.add(helpMenuItem);    JMenuItem aboutMenuItem = new JMenuItem(ABOUT_CSMART_ITEM);    aboutMenuItem.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  URL about = (URL)this.getClass().getResource(ABOUT_DOC);	  if (about != null)	    Browser.setPage(about);	}      });    helpMenu.add(aboutMenuItem);    legend = new Legend();    JMenuItem legendMenuItem = new JMenuItem(LEGEND_MENU_ITEM);    legendMenuItem.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {          legend.setVisible(true);	}      });    helpMenu.add(legendMenuItem);        JMenuBar menuBar = new JMenuBar();    menuBar.add(fileMenu);    menuBar.add(viewMenu);    menuBar.add(notifyMenu);    menuBar.add(helpMenu);    getRootPane().setJMenuBar(menuBar);    // create panel which contains    // description panel, status button panel, and tabbed panes    JPanel panel = new JPanel(new GridBagLayout());    // descriptionPanel contains society name, trial name, control buttons    JPanel descriptionPanel = createHorizontalPanel(true);    descriptionPanel.add(Box.createRigidArea(VGAP30));    descriptionPanel.add(Box.createRigidArea(HGAP10));    descriptionPanel.add(new JLabel(cc.getSocietyName()));    descriptionPanel.add(Box.createRigidArea(HGAP5));    descriptionPanel.add(new JLabel("Trial: "));    descriptionPanel.add(Box.createRigidArea(HGAP5));    trialNameLabel = new JLabel("");    descriptionPanel.add(trialNameLabel);    descriptionPanel.add(Box.createRigidArea(HGAP10));        runButton = new JToggleButton("Run");    runButton.setToolTipText("Start running experiment");    runButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	runButton_actionPerformed(e);      }    });    runButton.setFocusPainted(false);    descriptionPanel.add(runButton);    descriptionPanel.add(Box.createRigidArea(HGAP5));        stopButton = new JToggleButton("Stop");    stopButton.setToolTipText("Halt experiment at end of current");    stopButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	stopButton_actionPerformed(e);      }    });    stopButton.setFocusPainted(false);    descriptionPanel.add(stopButton);    descriptionPanel.add(Box.createRigidArea(HGAP5));    abortButton = new JToggleButton("Abort");    abortButton.setToolTipText("Interrupt experiment");    abortButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	abortButton_actionPerformed(e);      }    });    abortButton.setFocusPainted(false);    descriptionPanel.add(abortButton);    // create progress panel for progress bar and trial and experiment times    trialProgressBar = new JProgressBar(0, experiment.getTrialCount() + 1);    trialProgressBar.setValue(0);    trialProgressBar.setStringPainted(true);    JPanel progressPanel = new JPanel(new GridBagLayout());    progressPanel.add(trialProgressBar,		      new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,					     GridBagConstraints.WEST,					     GridBagConstraints.HORIZONTAL,                                             new Insets(5, 0, 0, 0),					     0, 0));    final JLabel trialTimeLabel = new JLabel("Trial: 00:00:00");    final JLabel experimentTimeLabel = new JLabel("Experiment: 00:00:00");    myNumberFormat = new DecimalFormat("00");    // create trial progress panel for time labels    JPanel trialProgressPanel = createHorizontalPanel(false);    if (!experiment.isInDatabase()) {      trialProgressPanel.add(trialTimeLabel);      trialProgressPanel.add(Box.createRigidArea(HGAP10));    }    trialProgressPanel.add(experimentTimeLabel);    progressPanel.add(trialProgressPanel,		      new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,					     GridBagConstraints.WEST,					     GridBagConstraints.HORIZONTAL,                                             new Insets(0, 0, 0, 0),					     0, 0));        descriptionPanel.add(Box.createRigidArea(HGAP10));    descriptionPanel.add(progressPanel);    descriptionPanel.add(Box.createRigidArea(HGAP10));    // add description panel to top panel    panel.add(descriptionPanel, 	      new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,				     GridBagConstraints.WEST,				     GridBagConstraints.HORIZONTAL,                                     new Insets(0, 10, 2, 10),				     0, 0));    // set up trial and experiment timers    trialTimer =       new javax.swing.Timer(1000, new ActionListener() {	public void actionPerformed(ActionEvent e) {	  trialTimeLabel.setText(getElapsedTimeLabel("Trial: ",						     startTrialTime));	}      });    experimentTimer =       new javax.swing.Timer(1000, new ActionListener() {	public void actionPerformed(ActionEvent e) {	  experimentTimeLabel.setText(getElapsedTimeLabel("Experiment: ", 						   startExperimentTime));	}      });    // create status button panel, initially with no buttons    buttonPanel = createHorizontalPanel(true);    buttonPanel.add(Box.createRigidArea(HGAP10));    buttonPanel.add(new JLabel("Node Status"));    buttonPanel.add(Box.createRigidArea(HGAP10));    buttonPanel.add(Box.createRigidArea(VGAP30));    panel.add(buttonPanel,	      new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,				     GridBagConstraints.WEST,				     GridBagConstraints.HORIZONTAL,                                     new Insets(0, 10, 0, 10),				     0, 0));    statusButtons = new ButtonGroup();    nodeMenu = new JPopupMenu();    Action aboutAction = new AbstractAction(ABOUT_ACTION) {      public void actionPerformed(ActionEvent e) {        displayAboutNode();      }    };    nodeMenu.add(aboutAction);    Action resetAction = new AbstractAction(RESET_ACTION) {      public void actionPerformed(ActionEvent e) {        resetNodeStatus();      }    };    Action legendAction = new AbstractAction(LEGEND_MENU_ITEM) {      public void actionPerformed(ActionEvent e) {        legend.setVisible(true);      }    };    nodeMenu.add(resetAction);    nodeMenu.addSeparator();    nodeMenu.add(legendAction);    // create tabbed panes for configuration information (not editable)    hostConfiguration = new HostConfigurationBuilder(experiment, csmart);    hostConfiguration.update(); // set host configuration to display 1st trial    hostConfiguration.addHostTreeSelectionListener(myTreeListener);    JInternalFrame jif = new JInternalFrame("Configuration",                                            true, false, true, true);    jif.getContentPane().add(hostConfiguration);    jif.setSize(300, 300);    jif.setLocation(0, 0);    jif.setVisible(true);    desktop.add(jif, JLayeredPane.DEFAULT_LAYER);    if (!experiment.isInDatabase()) {      PropertyEditorPanel trialViewer =         new PropertyEditorPanel(experiment.getComponentsAsArray());      jif = new JInternalFrame("Trial Values", true, false, true, true);      jif.getContentPane().add(trialViewer);      jif.setSize(300, 300);      jif.setLocation(310, 0);      jif.setVisible(true);      desktop.add(jif, JLayeredPane.DEFAULT_LAYER);    }    panel.add(desktop,	      new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,				     GridBagConstraints.WEST,				     GridBagConstraints.BOTH,                                     new Insets(0, 0, 0, 0),				     0, 0));    getContentPane().add(panel);    // enable run button if have experiment with at least one host, node,    // and agent    initRunButton();    stopButton.setEnabled(false);    abortButton.setEnabled(false);    // add a WindowListener: Do an exit to kill the Nodes    // If this window is closing    // Note that the main CSMART UI handles actually disposing    // this frame    addWindowListener(new WindowAdapter() {      public void windowClosing(WindowEvent e) {	updateExperimentEditability();	exitMenuItem_actionPerformed(e);      }    });    pack();    setSize(700, 600);    setVisible(true);  }