package transformation.associationtags.buttonlisteners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;

public class MenuListener implements ActionListener {
	
	JComboBox otherMenu;

	public MenuListener(JComboBox menu) {
		this.otherMenu = menu;
	}
	
	/**
	 * When an element is selected from a dropdown menu, 
	 * also changes the element of an identical dropdown menu
	 */
	public void actionPerformed(ActionEvent e) {
		
		JComboBox menu = (JComboBox) e.getSource();
		otherMenu.setSelectedIndex(menu.getSelectedIndex());

	}

}
