public TradeDialog(Frame parent, final Landscape landscape) {
		super(parent, true);
		newdialog = this;
		this.landscape = landscape;
		
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		GridBagLayout gbl_contentPanel = new GridBagLayout();
		gbl_contentPanel.columnWidths = new int[]{151, 0};
		gbl_contentPanel.rowHeights = new int[]{15, 0, 0};
		gbl_contentPanel.columnWeights = new double[]{1.0, Double.MIN_VALUE};
		gbl_contentPanel.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		contentPanel.setLayout(gbl_contentPanel);
		{
			JLabel title = new JLabel("Performing trading");
			GridBagConstraints gbc_title = new GridBagConstraints();
			gbc_title.insets = new Insets(0, 0, 5, 0);
			gbc_title.anchor = GridBagConstraints.WEST;
			gbc_title.gridx = 0;
			gbc_title.gridy = 0;
			contentPanel.add(title, gbc_title);
		}
		{
			//add other items here
			for (int i = 0 ; i < values.size(); i++) {
				String name = values.get(i);
				int count = getCount(name);
				Integer buyCost = getBuyCost(name);
				Integer sellValue = getSellValue(name); 
				
				addItem(name, count, buyCost, sellValue, i+1);
			}
		}
		
		{
			String name = "Worker";
			int count = landscape.getAgentCount();
			Integer buyCost = WORKERCOST;
			
			addItem(name, count, buyCost, null, values.size()+1);
		}

		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton cancelButton = new JButton("Close");
				cancelButton.setActionCommand("Close");
				buttonPane.add(cancelButton);
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						newdialog.dispose();
					}
				});
			}
		}

		//refresh information
		ActionListener refreshListener = new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				//only start a new worker if the last one has finished
				if (refreshworker == null 
						|| refreshworker.isDone()) {
					refreshworker = new SwingWorker<Void, Void>() {
						protected Void doInBackground() throws Exception {
							
							//update counts
							for (int i = 0 ; i < values.size(); i++) {
								int count = getCount(values.get(i));
								counts.get(i).setText(""+count);
								//if no counts, can't sell
								if (count <= 0) {
									sells.get(i).setEnabled(false);
								} else {
									sells.get(i).setEnabled(true);
								}
							}
							//update count of workers
							counts.get(values.size()).setText(""+landscape.getAgentCount());
							
							
							//update if we can afford to buy
							int cash = landscape.getMoney();
							for (int i = 0 ; i < values.size(); i++) {
								if (getBuyCost(values.get(i)) > cash) {
									buys.get(i).setEnabled(false);
								} else {
									buys.get(i).setEnabled(true);
								}
							}
							//update worker buy button
							if (WORKERCOST > cash) {
								buys.get(values.size()).setEnabled(false);
							} else {
								buys.get(values.size()).setEnabled(true);
							}
							
							return null;
						}	
					};
					refreshworker.execute();
				}
			}
		};
		refreshTimer = new Timer(1, refreshListener);
		refreshTimer.start();
	}