Vabbene. Questa è la parte di codice interessata alla costruzione della lista e dov'è invocata la classe per azionare l'evento per aggiungere il prodotto:

codice:
	private void getProduct() {
		DataBase connessione = new DataBase();
		Statement statement = connessione.getCmd();
		//Query per recuperare un certo tipo di prodotto
		String qry = "SELECT * FROM PRODOTTO WHERE TIPO='" + this.getTitleSection() + "' ORDER BY NOME ASC";
		ResultSet res;
		try {
			int indiceRiga = 1;
			res = statement.executeQuery(qry);
			int contaElementi = 0;
			while(res.next()) {
				contaElementi++;
				if(contaElementi >= (ConDimension.NUM_PRODUCT_PAGE*this.getPagina()+1) && contaElementi <= (ConDimension.NUM_PRODUCT_PAGE*this.getPagina()+ConDimension.NUM_PRODUCT_PAGE)) {
					JLabel testo1 = new JLabel(res.getString("Nome"));
					GridBagConstraints gbc2 = new GridBagConstraints();
					gbc2.gridy = indiceRiga;
					gbc2.gridx = 1;
					midListMenuPanel.add(testo1,  gbc2);
					JLabel testo2 = new JLabel(res.getString("Prezzo") + " €");
					gbc2.gridx = 2;
					midListMenuPanel.add(testo2, gbc2);
					
					JButton addProduct = new JButton("+");
					gbc2.gridx = 5;
					midListMenuPanel.add(addProduct, gbc2);
					addProduct.addActionListener(new AddProduct(res.getInt("ID_PRODOTTO"), res.getDouble("PREZZO")));
					
					JLabel q = new JLabel("" + ShoppingCart.showQuantita(res.getInt("ID_PRODOTTO")));
					gbc2.gridx = 4;
					midListMenuPanel.add(q, gbc2);
					
					JButton minProduct = new JButton("-");
					gbc2.gridx = 3;
					midListMenuPanel.add(minProduct, gbc2);
					minProduct.addActionListener(new MinProduct(res.getInt("ID_PRODOTTO"), res.getDouble("PREZZO")));
					
					indiceRiga += 1;
				}
			}
			res.close();
			statement.close();
			connessione.closeConnectionToDB();
		} catch (SQLException e) {
			e.printStackTrace();
			return;
		}
	}
Questa è la classe che aggiunge:

codice:
public class AddProduct implements ActionListener{
	
	private int id;
	private double prezzo;
	
	public AddProduct(int id, double p) {
		setId(id);
		setPrezzo(p);
	}
	
	private void setId(int id) {
		this.id = id;
	}
	
	private int getId() {
		return id;
	}
	
	private void setPrezzo (double p) {
		prezzo = p;
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		addProduct();
	}
	
	/**
	 * Metodo per aggiungere un prodotto all'ordinazione.
	 */
	public void addProduct() {
		int ind = ShoppingCart.idProduct.indexOf(getId());
		if(ind == -1) {
			ShoppingCart.idProduct.add(getId());
			ShoppingCart.quantita.add(1);
		} else {
			int elem = ShoppingCart.quantita.get(ind);
			elem++;
			ShoppingCart.quantita.setElementAt(elem, ind);
		}
		Service.getService().setConto(prezzo);
	}
}