@Override
	public void actionPerformed(ActionEvent ae) 
	{
		// TODO Auto-generated method stub
		if(ae.getSource()==okButton)
		{
			if(nameTextField.getText().equals("")  || subjectTextField.getText().equals("") || topicTextField.getText().equals(""))
			{
				JOptionPane.showMessageDialog(this,"Please fill all the Fields","Field Missing",JOptionPane.ERROR_MESSAGE);
			}
			else
			{
				professorsName=nameTextField.getText();
				departmentName=departmentList.getSelectedItem()+"";
				subjectName=subjectTextField.getText();
				topicName=topicTextField.getText();
				this.dispose();
			}				
		}
		else if(ae.getSource()==cancelButton)
		{
			if(JOptionPane.showConfirmDialog(this, "Are you sure, you want to exit?","Confirm Exit Dialog",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.NO_OPTION)
				return;
			
			System.exit(1);
		}
		else if(ae.getSource()==departmentList)
		{
			if(departmentList.getSelectedItem().toString().equals("Other"))
			{
				departmentList.addItem(""+JOptionPane.showInputDialog("Enter your Department Name"));
				departmentList.setSelectedIndex(departmentList.getItemCount()-1);
			}
		}
	}