@Override
	public void actionPerformed(ActionEvent arg0) {
		
		String[] names = getAllProductNames();
        JComboBox combo = new JComboBox(names);
        JTextField field1 = new JTextField("");
        JTextField field2 = new JTextField("");
        JPanel panel = new JPanel(new GridLayout(0, 1));
        panel.add(combo);
        panel.add(new JLabel("Login:"));
        panel.add(field1);
        panel.add(new JLabel("Role:"));
        panel.add(field2);
        int result = JOptionPane.showConfirmDialog(frame, panel, "Product deletion window",
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
        if (result == JOptionPane.OK_OPTION) {
        		productName = (String)combo.getSelectedItem();
        		
			try {
				PreparedStatement preparedStatement = products.getConnection().prepareStatement("delete from products where name = ?");
				preparedStatement.setString(1,productName);
				
				preparedStatement.executeUpdate();
				DefaultTableModel model = (DefaultTableModel)(table.getModel());
				int row = -1;
				int count = 0;
				for(String element:names) {
					
					if(productName.equals(element)) {
						row = count;
						break;
					}
					count++;
				}
				if (row == -1) {
					throw new RuntimeException("Something went wrong when finding login to remove.");
				}
				model.removeRow(row);
				JOptionPane.showMessageDialog(frame, "Product "+productName+" removed.");
				//model.fireTableDataChanged();
				
			} catch (SQLException e) {
				JOptionPane.showMessageDialog(frame, "Couldn't remove product.");
				
			}
		}
  
	}