public ParallelVisualizer() {

    	// Populates the list of resources
    	Collection<Sim_entity> entities = Sim_system.getEntityList();
    	for(Sim_entity entity : entities) {
    		if(entity instanceof ParallelResource) {
    			resources.add((ParallelResource)entity);
    		}
    	}

		initResourceWindows();
		
		super.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
		super.setTitle("GridSim " + GridSim.GRIDSIM_VERSION_STRING + " Visualizer");

		JPanel mainPanel = new JPanel(new GridLayout(0, 1));
		JPanel simulationPanel = new JPanel(new GridLayout(0, 3));

		Border simulationBorder = BorderFactory.createTitledBorder(
				BorderFactory.createEtchedBorder(EtchedBorder.RAISED), "Simulation");
		simulationPanel.setBorder(simulationBorder);
		
		JPanel executionPanel = new JPanel(new GridLayout(3,1));
		executionPanel.setBorder(new TitledBorder("Execution"));
		
		JPanel pausePanel = new JPanel(new GridLayout(3,1));
		pausePanel.setBorder(new TitledBorder("Pause Condition"));
					
		btStep = new JButton("Step by Step");
		btRun = new JButton("Run");
		btSlowMotion = new JButton("Slow Motion");
		
		btStep.addActionListener(this);
		btRun.addActionListener(this);
		btSlowMotion.addActionListener(this);
		
		JLabel lbRunUntil = new JLabel(" Pause at (Seconds):");
		lbRunUntil.setAlignmentY(JTextField.CENTER_ALIGNMENT);
		
		tfRunUntil = new JTextField(10);
		btChangePause = new JButton("Change");
		executionPanel.add(btStep);

		pausePanel.add(lbRunUntil);
		pausePanel.add(tfRunUntil);
		pausePanel.add(btChangePause);
		
		btChangePause.addActionListener(this);
		executionPanel.add(btSlowMotion);
		executionPanel.add(btRun);
		
		ArrayList<String> resourceNames = new ArrayList<String>();
		for(GridResource resource : resources) {
			resourceNames.add(resource.getName());
		}
		
        jlResource = new JList();
        jlResource.setListData(resourceNames.toArray());
        jlResource.setBackground(this.getBackground());
        jlResource.addListSelectionListener(this);
        
        JPanel resourcePanel = new JPanel(new GridLayout(0, 1));
        resourcePanel.setBorder(new TitledBorder("Resources"));
        JScrollPane scrollResourcePanel = new JScrollPane(jlResource);
        resourcePanel.add(scrollResourcePanel);
      
        simulationPanel.add(executionPanel);
        simulationPanel.add(pausePanel);
        simulationPanel.add(resourcePanel);    
        
        jlResourceInfo = new JTextArea();
        jlResourceInfo.setBackground(this.getBackground());
		jlResourceInfo.setEditable(false);
        
        JPanel resourceInfoPanel = new JPanel(new GridLayout(0, 1));
        resourceInfoPanel.setBorder(new TitledBorder("Resource Details"));
        resourceInfoPanel.add(jlResourceInfo);

        Border resourceInfoBorder = BorderFactory.createTitledBorder(
        		BorderFactory.createEtchedBorder(EtchedBorder.RAISED), "Resource Details");
        resourceInfoPanel.setBorder(resourceInfoBorder);

        mainPanel.add(simulationPanel);
        mainPanel.add(resourceInfoPanel);
        
        JPanel statusPanel = new JPanel();
        statusPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        status = new JLabel("Current simulation time is " + GridSim.clock() + " seconds.");
        statusPanel.add(status);
        
        createMenuBar();
        
        super.setLocation(0, 0);
		super.getContentPane().add(mainPanel, BorderLayout.CENTER);
		super.getContentPane().add(statusPanel, BorderLayout.SOUTH);
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Creates the thread responsible for starting the simulation
		simThread = new Thread("Simulation") {
			public void run() {
				// here in fact, start the simulation
				GridSim.startGridSimulation();
				
				if(executeAtEnd != null) {
					executeAtEnd.run();
				}
			}
		};
		
		super.setVisible(true);
	}